7 Replies Latest reply on Nov 11, 2002 4:08 PM by pranab

    jboss-3.0.4_tomcat-4.1.12  UnifiedClassLoader3 problem

    pranab Newbie

      The UnifiedClassLoader3 is not able to load classes from the WEB-INF/lib/*.jar. This problem didnt exist in jboss-3.0.2_tomcat-4.0.4
      I was able to deploy my WebApp EAR in 3.0.2 without any problems now it gives this error.I tried to trace it and found new threaded classloader using a repository.So the repository dump is not showing the package names for the classes stored in the WEB-INF.lib/*.jars.
      The error message is
      20:31:51,396 INFO [Engine] StandardWrapper[:default]: Loading container servlet default
      20:31:51,506 ERROR [Digester] Begin event threw exception
      java.lang.ClassNotFoundException: No ClassLoaders found for: org.apache.commons.workflow.base.BaseActivity
      at org.jboss.mx.loading.LoadMgr.beginLoadTask(LoadMgr.java:138)

      it is failing in this piece of code in LoadMgr.java
      beginLoadTask()

      // Get the set of class loaders from the packages map
      HashSet pkgSet = repository.getPackageClassLoaders(task.classname);
      // If no pkg match was found there is no point looking any further
      if( pkgSet == null || pkgSet.size() == 0 )
      {
      if( trace )
      log.trace("End beginLoadTask, ClassNotFoundException");
      String msg = "No ClassLoaders found for: "+task.classname;
      throw new ClassNotFoundException(msg);
      }

      The authors might know where is supposed to look for the jar classes.

      Pranab

        • 1. Re: jboss-3.0.4_tomcat-4.1.12  UnifiedClassLoader3 problem
          Adrian Brock Master

          My guess is that if you post the rest of the
          stack trace you have Class.forName() in there
          somewhere.

          My guess is also that tomcat-4.0.4 didn't include
          the class using Class.forName() but tomcat-4.1.12
          does.

          Regards,
          Adrian

          • 2. Re: jboss-3.0.4_tomcat-4.1.12  UnifiedClassLoader3 problem
            pranab Newbie

            20:31:49,083 INFO [Engine] ContextConfig[]: Added certificates -> request attribute Valve
            20:31:49,093 INFO [Engine] ContextConfig[]: Configured an authenticator for method FORM
            20:31:50,916 INFO [EmbeddedCatalinaService41] Using Java2 parent classloader delegation: true
            20:31:50,916 INFO [Engine] StandardManager[]: Seeding random number generator class java.security.SecureRandom
            20:31:50,916 INFO [Engine] StandardManager[]: Seeding of random number generator has been completed
            20:31:51,346 INFO [Engine] StandardWrapper[:webdav]: Loading container servlet webdav
            20:31:51,396 INFO [Engine] StandardWrapper[:default]: Loading container servlet default
            20:31:51,506 ERROR [Digester] Begin event threw exception
            java.lang.ClassNotFoundException: No ClassLoaders found for: org.apache.commons.workflow.base.BaseActivity
            at org.jboss.mx.loading.LoadMgr.beginLoadTask(LoadMgr.java:138)
            at org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:140)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
            at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:252)
            at org.apache.commons.digester.Digester.startElement(Digester.java:1237)
            at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1371)
            at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:828)
            at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1852)
            at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1000)
            at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
            at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:908)
            at org.apache.commons.digester.Digester.parse(Digester.java:1514)
            at com.pkd.struts.xtn.workflow.RegistryServlet.parse(RegistryServlet.java:431)
            at com.pkd.struts.xtn.workflow.RegistryServlet.init(RegistryServlet.java:380)
            at javax.servlet.GenericServlet.init(GenericServlet.java:256)
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:924)
            at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:813)
            at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3341)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:3534)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
            at org.jboss.web.catalina.EmbeddedCatalinaService41.createWebContext(EmbeddedCatalinaService41.java:432)
            at org.jboss.web.catalina.EmbeddedCatalinaService41.performDeploy(EmbeddedCatalinaService41.java:306)
            at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:300)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:807)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:799)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:585)
            at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
            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:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy4.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:435)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:656)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:261)
            at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
            at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
            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:517)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
            at $Proxy0.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:398)
            at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
            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:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy3.start(Unknown Source)
            at org.jboss.deployment.SARDeployer.start(SARDeployer.java:249)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:807)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:585)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:569)
            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:517)
            at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:324)
            at org.jboss.system.server.ServerImpl.start(ServerImpl.java:221)
            at org.jboss.Main.boot(Main.java:148)
            at org.jboss.Main$1.run(Main.java:381)
            at java.lang.Thread.run(Thread.java:536)

            • 3. Re: jboss-3.0.4_tomcat-4.1.12  UnifiedClassLoader3 problem
              pranab Newbie

              attached server trace file for org.jboss.mx.loading package

              • 4. Re: jboss-3.0.4_tomcat-4.1.12  UnifiedClassLoader3 problem
                pranab Newbie

                attached server trace file for org.jboss.mx.loading package

                • 5. Re: jboss-3.0.4_tomcat-4.1.12  UnifiedClassLoader3 problem
                  Adrian Brock Master

                  http://cvs.apache.org/viewcvs.cgi/jakarta-commons/digester/src/java/org/apache/commons/digester/ObjectCreateRule.java?rev=1.12&content-type=text/vnd.viewcvs-markup

                  This is just as bad.

                  It starts the search at the location of the digester
                  class which is probably
                  server/default/lib

                  It should be using the WEB-INF/lib which is
                  Thread.currentThread().getContextClassLoader()
                  not
                  digester.getClassLoader()

                  One day the apache guys will learn to play
                  nice without having to put every jar in WEB-INF/lib
                  and turning on the servlet classloader.

                  Regards,
                  Adrian

                  • 6. Re: jboss-3.0.4_tomcat-4.1.12  UnifiedClassLoader3 problem
                    pranab Newbie

                    Adrian,
                    The digester.getClassLoader() is actually doing this
                    public ClassLoader getClassLoader() {

                    if (this.classLoader != null) {
                    return (this.classLoader);
                    }
                    if (this.useContextClassLoader) {
                    ClassLoader classLoader =
                    Thread.currentThread().getContextClassLoader();
                    if (classLoader != null) {
                    return (classLoader);
                    }
                    }
                    return (this.getClass().getClassLoader());

                    }
                    If useContextClassLoader is set before calling the digester.parse() it will use the Thread.currentThread().getContextClassLoader() which is what you have explained. Apparently I made changes to the com.pkd.struts.xtn.workflow.RegistryServlet.init servlet init params to set the digester to use context classloader.The results are same as before.
                    The other thing to notice in the Stack trace is the classloader being used by the digester, which is org.jboss.mx.loading.UnifiedClassLoader3. It must be able to find the class from the WEB-INF/lib jars.

                    java.lang.ClassNotFoundException: No ClassLoaders found for: org.apache.commons.workflow.base.BaseActivity
                    at org.jboss.mx.loading.LoadMgr.beginLoadTask(LoadMgr.java:138)
                    at org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:140)
                    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
                    at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:252)


                    Regards

                    Pranab

                    • 7. Re: jboss-3.0.4_tomcat-4.1.12  UnifiedClassLoader3 problem
                      pranab Newbie

                      Found the problem in RegistryServlet.java from struts/contributions which does not set the useContextClassLoader for the digester.Once it is done deployment was smooth. Thanks for your help Adrian.

                      Pranab