11 Replies Latest reply on Jun 20, 2004 1:50 AM by starksm64

    URGENT: Classloading issue: No class found even that the cla

    thuesler

      Hi all

      I am still fighting around my classloading problems. Acutally I use JDom and Dom4j with Xerxes as parser... When I try to load some classes I get a class not found exception.

      The following is the call Stack:
      JXML Helper (myEAR) calls...

      XPath (Jdom.jar contained in myEAR but uses the one from the Jboss Bootstrap (Jboss Dir\lib)) creates new Instance of..

      JaxenXPath (contained in the jDom.jar) includes / uses some Sax stuff (SaxPathException) contained in Dom4j.jar

      SaxPathException (contained in dom4j.jar which is in my ear) is attempted to be loaded but not found

      Below the print of org.jboss.util.Debug.displayClassInfo (printed in the JXMLHelper => last class that I have under control):

      14:27:22,777 INFO [STDOUT] Classloading information from JXMLHelper:
      Debug Information for JXmlHelper class itself:

      ch.argentis.base.xml.JXmlHelper(d7cf62).ClassLoader=org.jboss.mx.loading.UnifiedClassLoader3@1a517bd{ url=file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1
      .24/server/tebs/tmp/deploy/tmp55706tebs-0.1-SNAPSHOT.ear ,addedOrder=24}
      ..org.jboss.mx.loading.UnifiedClassLoader3@1a517bd{ url=file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/server/tebs/tmp/deploy/tmp55706tebs-0.1-SNAPSH
      OT.ear ,addedOrder=24}
      ..org.jboss.system.server.NoAnnotationURLClassLoader@e3b895
      ..sun.misc.Launcher$AppClassLoader@e80a59
      ....file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/bin/
      ....file:/C:/Entwicklungstools/abaXX/components36/lib/3rdparty/oracle9iR2.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/lib/tools.jar
      ....file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/bin/run.jar
      ..sun.misc.Launcher$ExtClassLoader@1ff5ea7
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/dnsns.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/ldapsec.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/localedata.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/sunjce_provider.jar
      ++++CodeSource: (file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/server/tebs/tmp/deploy/tmp55706tebs-0.1-SNAPSHOT.ear-contents/tebs-migration-0.1-SNAP
      SHOT.jar <no certificates>)
      Implemented Interfaces:
      14:27:22,777 INFO [STDOUT] Debug Information for JDom class XPath:

      org.jdom.xpath.XPath(14ad296).ClassLoader=org.jboss.system.server.NoAnnotationURLClassLoader@e3b895
      ..org.jboss.system.server.NoAnnotationURLClassLoader@e3b895
      ..sun.misc.Launcher$AppClassLoader@e80a59
      ....file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/bin/
      ....file:/C:/Entwicklungstools/abaXX/components36/lib/3rdparty/oracle9iR2.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/lib/tools.jar
      ....file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/bin/run.jar
      ..sun.misc.Launcher$ExtClassLoader@1ff5ea7
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/dnsns.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/ldapsec.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/localedata.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/sunjce_provider.jar
      ++++CodeSource: (file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/lib/jdom.jar <no certificates>)
      Implemented Interfaces:
      ++interface java.io.Serializable(f62373)
      ++++ClassLoader: null
      ++++Null CodeSource
      14:27:22,777 INFO [STDOUT] Debug Information for Dom4J class SAXPathException:

      org.saxpath.SAXPathException(1399ae5).ClassLoader=org.jboss.mx.loading.UnifiedClassLoader3@1a517bd{ url=file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.2
      4/server/tebs/tmp/deploy/tmp55706tebs-0.1-SNAPSHOT.ear ,addedOrder=24}
      ..org.jboss.mx.loading.UnifiedClassLoader3@1a517bd{ url=file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/server/tebs/tmp/deploy/tmp55706tebs-0.1-SNAPSH
      OT.ear ,addedOrder=24}
      ..org.jboss.system.server.NoAnnotationURLClassLoader@e3b895
      ..sun.misc.Launcher$AppClassLoader@e80a59
      ....file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/bin/
      ....file:/C:/Entwicklungstools/abaXX/components36/lib/3rdparty/oracle9iR2.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/lib/tools.jar
      ....file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/bin/run.jar
      ..sun.misc.Launcher$ExtClassLoader@1ff5ea7
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/dnsns.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/ldapsec.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/localedata.jar
      ....file:/C:/Entwicklungstools/j2sdk_1.4.2_03/jre/lib/ext/sunjce_provider.jar
      ++++CodeSource: (file:/C:/Entwicklungstools/jboss-3.2.3_tomcat-4.1.24/server/tebs/tmp/deploy/tmp55706tebs-0.1-SNAPSHOT.ear-contents/dom4j-1.4.jar <no certi
      ficates>)
      Implemented Interfaces:


      Actually when the code then runs through to the XPath and tries to load the SaxPathException I get the following stack trace:

      14:27:22,793 ERROR [LogInterceptor] Unexpected Error:
      java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:141)
      at org.jdom.xpath.XPath.newInstance(XPath.java:133)
      at ch.argentis.base.xml.JXmlHelper.getValue(JXmlHelper.java:167)
      at ch.argentis.base.xml.JXmlHelper.getTextOrNull(JXmlHelper.java:133)
      at ch.argentis.base.util.Configuration.getTextOrNull(Configuration.java:158)
      at ch.argentis.base.util.Configuration.getString(Configuration.java:168)
      at ch.argentis.base.util.Configuration.init(Configuration.java:86)
      at ch.argentis.base.util.Configuration.(Configuration.java:68)
      at ch.argentis.base.util.Configuration.(Configuration.java:41)
      at ch.argentis.base.util.logging.LoggerFactory.(LoggerFactory.java:43)
      at ch.argentis.base.persistence.core.common.SystemStartupBean.(SystemStartupBean.java:48)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
      at java.lang.Class.newInstance0(Class.java:308)
      at java.lang.Class.newInstance(Class.java:261)
      at org.jboss.ejb.Container.createBeanClassInstance(Container.java:469)
      at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:168)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:58)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:297)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      at org.jboss.ejb.Container.invoke(Container.java:700)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)


      For me it looks like jboss has some mess with the classloaders and doesn't loads the class from my ear but tries to load it using the Bootstrap classloader itself...

      Any help is appreciated as no deployment is possible any more

      Kind regards
      tom

        • 1. Re: URGENT: Classloading issue: No class found even that the

           

          "thuesler@hotmail.com" wrote:


          < snip />

          14:27:22,793 ERROR [LogInterceptor] Unexpected Error:
          java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:141)
          at org.jdom.xpath.XPath.newInstance(XPath.java:133)
          at ch.argentis.base.xml.JXmlHelper.getValue(JXmlHelper.java:167)

          For me it looks like jboss has some mess with the classloaders and doesn't loads the class from my ear but tries to load it using the Bootstrap classloader itself...


          Who has some mess?

          Thread.currentThread().getContextClassLoader().loadClass() not Class.forName()

          • 2. Re: URGENT: Classloading issue: No class found even that the
            thuesler

            Adrian

            Thanks a lot for your fast reply. Acutally I relly did not recognize that is using Class.forName()...

            This is an indepent library out of my control, that actually JBoss is also using.

            Do I have any chance to influence the behaviour of Class.forName() in a way that it will use the right classloader'????? Actually I mean JBoss also uses this library and seems to come up correctly... Why that?

            kind regards
            t

            • 3. Re: URGENT: Classloading issue: No class found even that the

              JBoss doesn't try to plugin user land classes.

              Put your class in a jar inside $JBOSS_HOME/lib
              then start jboss with

              ./run.sh -L myjar.jar
              


              Or get the jdom project to fix it.

              • 4. Re: URGENT: Classloading issue: No class found even that the
                thuesler

                Adrian

                Thanks again... With the -L switch I got it running...

                Cool end for a friday...

                Nice weekend
                -t

                • 5. Re: URGENT: Classloading issue: No class found even that the
                  chrisdutz

                  Hmmm ... is there a way to use JDom and Xpath within Jboss without having to do the "-L"-parameter stuff? I need to use Xpath inside an application and I don't want to do any hacks to the command-line.

                  Chris

                  • 6. Re: URGENT: Classloading issue: No class found even that the
                    vivkap01

                    Hi
                    I have a similar problem. I am using JBoss 3.2.3 and JDOM b9. I get this error:
                    ROR [STDERR] java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
                    2004-06-01 22:13:31,500 ERROR [STDERR] at java.lang.Class.forName0(Native Method)
                    2004-06-01 22:13:31,500 ERROR [STDERR] at java.lang.Class.forName(Class.java:141)
                    2004-06-01 22:13:31,500 ERROR [STDERR] at org.jdom.xpath.XPath.newInstance(XPath.java:126)
                    2004-06-01 22:13:31,500 ERROR [STDERR] at com.bitfone.server.commons.util.JDOMParser.getElement(JDOMParser.java:179)
                    2004-06-01 22:13:31,500 ERROR [STDERR] at com.bitfone.server.commons.util.JDOMParser.getElementText(JDOMParser.java:146)


                    It works fine on Tomcat/Weblogic and Orion but gives this error only on JBoss.
                    Is there a solution other than using the -L switch? Or is this a JDOM error and it is not going to work unless it is fixed in JDOM ?

                    --Viv

                    • 7. Re: URGENT: Classloading issue: No class found even that the
                      chrisdutz

                      I solved my problems by switching to dom4j ... I know this is a very unprofessional way, but I didn't have the time to figure out how to use XPath and dom4j is not used anywhere in jboss ;)

                      Give it a try, the changes are not too big
                      Chris

                      • 8. Re: URGENT: Classloading issue: No class found even that the

                        Class.forName() is going to cause problems.

                        • 9. Re: URGENT: Classloading issue: No class found even that the
                          starksm64

                          dom4j is used by jboss-3.2.4

                          • 10. Re: Classloading
                            wolfc

                             

                            "adrian@jboss.org" wrote:

                            Who has some mess?

                            Thread.currentThread().getContextClassLoader().loadClass() not Class.forName()


                            I disagree, when I do an import org.domain.SomeObject (and use it) it will be loaded by the currentClassLoader, not by the contextClassLoader. So in effect jdom uses saxpath as an import / hard depency. Nothing wrong with that.

                            IMHO the forest of UCLs is the problem. (or is that a flock? :-) )

                            Of one thing I'm sure: jBoss should not expose jdom.jar to deployed applications.

                            Don't get me wrong I like the UCL forest.
                            Ah I think I'm beginning to see the start of the tunnel:
                            - A.ear gets deployed
                            - B.ear wants to use interfaces
                            - either via same class loader to avoid class cast ex, or through marshalling which is slow
                            thus JBoss puts it all on one heap / loader repository.

                            The last part is not the way I preffer it.
                            What if:
                            - A.ear gets deployed
                            - B.ear gets deployed
                            both with hierarchical repositories which can access children.
                            Then A would load from (in order of priority) (very much simplified):
                            - server/test/deploy/A.ear/lib
                            - server/test/lib (parent)
                            - server/test/deploy/B.ear (siblings of parent)
                            - lib (parent)
                            - server/other/lib (siblings of parent)

                            This way jdom will get exposed but at a very late stage.

                            • 11. Re: URGENT: Classloading issue: No class found even that the
                              starksm64

                              If an ear is deployed with a heirarchical loader configuration no other deployment can load classes from it.