2 Replies Latest reply on Aug 22, 2012 8:39 AM by Alan Nisbet

    server/<>/lib jar java.lang.NoSuchMethodException

    Alan Nisbet Newbie

      Hi All,

       

      This seems like a relatively straightforward issue. Unfortunately I have very little experience of JBoss classloading. I have looked at the jboss classloading use cases page however there does not seem to be a scenario for what I require.

       

      I have an EAR deployed in server/<>/deploy

      I have a utility.jar in server/<>/lib

       

      Within the ear file I need to create an instance of class.A (in utility.jar) using Reflection, however I get the following error

       

      java.lang.NoSuchMethodException: xxx.xxx.xxx.MyClass.<init>(org.quartz.Scheduler, java.land.String)

             at java.lang.Class.getConstructor0(Class.java:2706)

             at java.lang.Class.getConstructor(Class.java:1657)

       

      When I include the utility.jar in the lib directory of the ear there is no such error so relatively confident the NoSuchMethodException is actually as a result of a classpath issue. I suspect a different classloader has been used for the utility.jar and the ear. I'm sure what I'm doing is possible, just missing a configuration option hopefully.

       

      I'm using JBoss 5.0.1.GA

      Ear Isolation is set to true

       

      Any help is appreciated.

        • 1. Re: server/<>/lib jar java.lang.NoSuchMethodException
          Alan Nisbet Newbie

          So i removed the reflection fto try and simplify;

           

          Error;

           

          java.lang.LinkageError: loader constraint violation: when resolving method "xxx.xxx.xxx.xxx.class.A.<init>(Lorg/quartz/Scheduler;Ljava/lang/String;)V" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, xxx/xxx/xxx/xxx/xxx/class.AFactory, and the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) for resolved class, xxx.xxx.xxx.xxx.class.A, have different Class objects for the type org/quartz/Scheduler used in the signature

          ...

          ...

          ...

           

          So either a different classloader is being used or there are different versions of the quartz scheduler. I will keep investigating, cheers in advance for any input. This also explains the reason for the NoSuchMethodException.

          • 2. Re: server/<>/lib jar java.lang.NoSuchMethodException
            Alan Nisbet Newbie

            So now know JBoss ships with 2006 version of Quartz

             

            Since I can't replace the version of quartz used by JBoss. I think my only option is to investigate a different deployment strategy for "plugging" in components. I can't use the server/<>/lib directory, not in this instance at least.