2 Replies Latest reply: Oct 1, 2009 8:11 AM by 843793 RSS

    Runtime Exception for Annocation Contains Arrays of Classes

    843793
      Hi,

      Same code works on IBM java, fails for sun java 1.6u16.
      The Annotation use seems like:
      @TsJmsDispatchedWebService(
                description = "Investigator service",
                name = InvestigatorWorker.SERVICE_NAME,
                moduleName="investigator-service",
                exposesInterface=ServiceAcquisitionWorker.class,
                serviceLogger = ServiceAcquisitionWorkerLogger.class,
                maxPoolSize=10,
                queueJNDIName="com.cramer.dy.toolkit.investigator.InvestigatorWorker",
                requiredLocalBeans = {AuManagerDelegateBean.class,
                     DataManagerDelegateBean.class,
                     RepositoryBean.class,
                     ConnectivityManagerDelegateBean.class,
                     CancelAgentDelegateBean.class}
                )
      where annotation code is:
      @Target(ElementType.TYPE)
      @Retention(RetentionPolicy.RUNTIME)
      public @interface TsJmsDispatchedWebService
      {
           String description();
           String name();
           String moduleName();
           Class exposesInterface();
           Class serviceLogger();
           String queueJNDIName();
           int maxPoolSize();
           Class[] requiredLocalBeans() default{};
      }
      During invoking the code:
      TsJmsDispatchedWebService annotation = getServiceClass().getAnnotation(TsJmsDispatchedWebService.class);
      I'm getting the runtime exception:
      Exception in thread "main" java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
              at sun.reflect.annotation.AnnotationParser.parseClassArray(Unknown Source)
              at sun.reflect.annotation.AnnotationParser.parseArray(Unknown Source)
              at sun.reflect.annotation.AnnotationParser.parseMemberValue(Unknown Source)
              at sun.reflect.annotation.AnnotationParser.parseAnnotation(Unknown Source)
              at sun.reflect.annotation.AnnotationParser.parseAnnotations2(Unknown Source)
              at sun.reflect.annotation.AnnotationParser.parseAnnotations(Unknown Source)
              at java.lang.Class.initAnnotationsIfNecessary(Unknown Source)
              at java.lang.Class.getAnnotation(Unknown Source)
      Should it be reported as a defect in java 1.6 runtime?
      Same code runs flawlessly on IBM java:
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build pwi3260sr2-20080818_01(SR2))
      IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Windows XP x86-32 jvmwi3260-20080816_22093 (JIT enabled, AOT enabled)
      J9VM - 20080816_022093_lHdSMr
      JIT - r9_20080721_1330ifx2
      GC - 20080724_AA)
      JCL - 20080808_02

      Am I correct on the thought?

      Thanks,
      Moti