1 Reply Latest reply on Jan 2, 2013 2:41 AM by mikevan

    Annotation problems

    migounette

      Hello all,

       

      We have an application that works fine on JBoss 5.1 but not on JBoss 6, the problem is related to the annotation.

       

      Quick question, it seems that an annotation scanning is done during the start of JBoss because I have a problem of classloading order.

       

      When I use isAnnotationPresent it returns true on JBoss 5 / false on JBoss 6. I don't know if jboss-mdr.jar is involved or not.

       

       

      More details:

      The annotation is used during the load of a SAR during the the start of JBoss, it has a dependency on the HA Singleton.

       

      I checked that the Service (SAR) has the two jars in its classpath:

       

           1st. A Jar file inside the SAR

           2nd. A reference via the jboss-service (with the class refence) and we put all stuff in a specific Classloader domain

       

           and I checked the  JBoss ClassLoader --> My Service Class Loader (all jars are here)

       

      When I looked at the Class.forName("MYClassA or MyClassB").getClassLoader() --> I have the same reference for JBoss 5 and JBoss 6.

       

      I am thinking of a change in the annotation loading, I looked at the jboss-scanning but it does not work or silent exception.

       

      Does anyone can confirm that JBoss tries to load annotation during the boot time in order to speed up the load of a class.

       

       

      I am lost after a long search....

       

      Any idea or help is welcome

       

      Thanks

        • 1. Re: Annotation problems
          mikevan

          Migou,

           

          I noticed a similar problem using Hibernate 3.x with JBoss 6.x and 7.x. The problem was that Hibernate and the JEE 3.0 spec use annotations of the same name. Because JBoss is configured to automatically scan for JEE (in this case JPA) annotations, JBoss mis-interpreted the Hibernate annotations as JPA. We used the jboss-scanning.xml hack to disable JBoss' JEE annotations scanning, and that allowed us to use Hibernate. Could this be the same issue you're running into?