2 Replies Latest reply on Oct 12, 2007 7:18 AM by pmuir

    Seam 1.2.1.GA incompatibility with IBM J9 VM

    refux

      Looks like the way the IBM J9 VM looks up annotations is a little different.
      Here are my observations of what is happening:

      We start trying to determine if a class has the Entity annotation:
      org.jboss.seam.Seam.isEntityClass(java.lang.Class<?>) line: 136

      if ( clazz.isAnnotationPresent(Entity.class) )


      Skipping a few bits of code, but soon enough we end up in the Class implementation looking for annotations:

      public <A extends Annotation> A getAnnotation(Class<A> annotation) {
       if (annotation == null) throw new NullPointerException();
       Annotation[] ans = getAnnotations();
       for (int i = 0; i < ans.length; i++) {
       if (ans.annotationType() == annotation) {
       return (A)ans;
       }
       }
       return null;
      }


      Then in the getAnnotations() method:
      public Annotation[] getAnnotations() {
       HashMap<String,Annotation> annotations = new HashMap<String,Annotation>();
       //Store annotations from the current class
       Annotation[] anns = getDeclaredAnnotations();
       ...
      


      In getDeclaredAnnotations() it goes all pear-shaped here:
      java.lang.Class.getDeclaredAnnotations() line: 1583
      annotations = AnnotationHelper.getDeclaredAnnotations(this, AnnotationHelper.ANNOTATION_TYPE_CLASS, null);


      At this point it goes into some internal IBM classes and comes up with this Exception:
      16:29:58,187 ERROR [STDERR] java.lang.TypeNotPresentException: Type javax.ejb.ApplicationException not present
      16:29:58,203 ERROR [STDERR] at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.java:38)
      16:29:58,203 ERROR [STDERR] at com.ibm.oti.reflect.AnnotationHelper.getDeclaredAnnotations(AnnotationHelper.java:50)
      16:29:58,203 ERROR [STDERR] at java.lang.Class.getDeclaredAnnotations(Class.java:1621)
      16:29:58,203 ERROR [STDERR] at java.lang.Class.getAnnotations(Class.java:1582)
      16:29:58,203 ERROR [STDERR] at java.lang.Class.getAnnotation(Class.java:1562)
      16:29:58,218 ERROR [STDERR] at java.lang.Class.isAnnotationPresent(Class.java:1649)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.Seam.isEntityClass(Seam.java:136)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.contexts.ServerConversationContext.set(ServerConversationContext.java:157)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.core.Exceptions.handle(Exceptions.java:77)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:71)
      16:29:58,218 ERROR [STDERR] at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
      16:29:58,218 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
      16:29:58,218 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      16:29:58,218 ERROR [STDERR] at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      16:29:58,218 ERROR [STDERR] at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
      16:29:58,218 ERROR [STDERR] at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      16:29:58,218 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      16:29:58,218 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      16:29:58,218 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      16:29:58,218 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      16:29:58,218 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      16:29:58,234 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      16:29:58,234 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      16:29:58,234 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      16:29:58,234 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      16:29:58,234 ERROR [STDERR] at java.lang.Thread.run(Thread.java:803)16:29:58,234 ERROR [STDERR] Caused by:
      16:29:58,234 ERROR [STDERR] java.lang.ClassNotFoundException: javax.ejb.ApplicationException
      16:29:58,234 ERROR [STDERR] at java.lang.Class.forName(Class.java:164)
      16:29:58,234 ERROR [STDERR] at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.java:33)
      16:29:58,234 ERROR [STDERR] ... 46 more



      If our target platform was JBoss this would not be an issue since we can just use the Sun JDK. However we want to run Seam in Websphere and thus have to use the IBM JDK.
      I reproduced this error in JBoss, just to make clear this is directly related to the IBM JDK and not Websphere.

      Java(TM) 2 Runtime Environment, Standard Edition (build pwi32devifx-20070323 (if
      ix 117674: SR4 + 116644 + 114941 + 116110 + 114881))
      IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223ifx-2007
      0323 (JIT enabled)
      J9VM - 20070322_12058_lHdSMR
      JIT - 20070109_1805ifx3_r8
      GC - WASIFIX_2007)
      JCL - 20070131