3 Replies Latest reply on May 26, 2009 8:08 PM by Richard Taylor

    JBoss 5 ClassLoading

    Angus Morison Newbie

      This is a plea for someone to explain JBoss 5 Classloading. According to Ales Justin, in this forum, the Unified Class Loader no longer exists. So (my understanding would be) all previous Wiki articles on Class Loading are now obsolete. Notably http://www.jboss.org/community/wiki/JBossClassLoadingUseCases.
      The only article on JBoss 5 class loading I have found is http://www.jboss.org/community/wiki/useJBossWebClassLoaderinJBoss5 (and incidentally I have not found any direct references to it, outside JIRA).

      I would have said that it did not necessarily need a core developper to do this; but maybe the subject is so complicated that it does.

      I know you guys are really busy, and work really long hours; but anything would be appreciated.

      Not surprisingly, perhaps, Scott Stark's getClassLoaders method is not very revealing with JBoss 5.
      On JBoss 5.0.1:

      16:54:36,015 INFO [STDOUT] +++ org.jboss.web.tomcat.service.WebCtxLoader$ENCLoader@f051af
      +++ BaseClassLoader@cc9ff5{vfszip:/C:/Other/eclipseall/ws/hsi/test-servlet/releasePackage/toast.war/}


      On JBoss 4.2.2:
      17:31:01,906 INFO [STDOUT] +++ org.jboss.web.tomcat.service.WebCtxLoader$ENCLoader@12c55fd
      +++ java.net.FactoryURLClassLoader@166e555
      +++ org.jboss.mx.loading.UnifiedClassLoader3@11199f0{ url=file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/de
      loy/tmp26489toast-exp.war/ ,addedOrder=53}
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/log4j.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26419trove.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/commons-collections.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/hibernate3.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/cglib.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26478jms-ra.rar-contents/jms-ra.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-monitoring.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jnpserver.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26423jboss-microcontainer.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/activation.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/el-api.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-vfs.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/bcel.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26422jboss-dependency.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26446wsdl4j.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/antlr.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbosssx.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/commons-httpclient.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26478jms-ra.rar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26475jboss-ha-xa-jdbc.rar-contents/jboss-ha-xa-
      dbc.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26480quartz-ra.rar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26440jaxb-impl.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/dom4j.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jbossws.sar/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jmx-adaptor-plugin.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-common-jdbc-wrapper.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/hsi-appender.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/servlet-api.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-jsr77.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/mail.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26428jboss-faces.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26430jsf-impl.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26447wstx.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/scheduler-plugin.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jbossws.sar/jbossws.beans/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-hibernate.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jmx-console.war/WEB-INF/classes/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jboss-web.deployer/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/http-invoker.sar/invoker.war/WEB-INF/classes/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jboss-web.deployer/ROOT.war/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26489toast-exp.war/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26436hsi-monitor.sar-contents/mbean.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/commons-codec.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-transaction.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/uuid-key-generator.sar/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-cache.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/juddi-service.sar/juddi.war/WEB-INF/classes/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/http-invoker.sar/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossjta.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26450juddi-service.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/commons-logging.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/bindingservice-plugin.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26417jboss-aop-jdk50.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/log4j-snmp-appender.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26420jboss-bean-deployer.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/javassist.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26452scout.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-management.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-srp.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26476jboss-local-jdbc.rar-contents/jboss-local-
      dbc.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jpl-util.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossws-native-jaxws-ext.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26415jboss-annotations-ejb3.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/bsf.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26477jboss-xa-jdbc.rar-contents/jboss-xa-jdbc.j
      r
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26443jettison.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26429jsf-api.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26477jboss-xa-jdbc.rar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26436hsi-monitor.sar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/mail-plugin.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26451juddi.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-ejb3x.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/slf4j-api-1.5.0.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jsp-api.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26441jboss-jaxb-intros.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossws-native-jaxws.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26425jbossweb-extras.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/hibernate-entitymanager.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26421jboss-container.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26475jboss-ha-xa-jdbc.rar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/WEB-INF/clas
      es/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-j2ee.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26438FastInfoset.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/slf4j-log4j12-1.5.0.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossws-common.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/ejb3.deployer/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26479mail-ra.rar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossts-common.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-jca.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26418jboss-aspect-library-jdk50.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossws-native-saaj.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26442jbossws-native-core.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26424jasper-jdt.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26489toast-exp.war/WEB-INF/classes/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-serialization.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jmx-console.war/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/bsh.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jgroups.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossws-jboss422.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jbossws.sar/jbossws-management.war/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/xmlentitymgr.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/juddi-service.sar/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26439jaxb-api.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossws-framework.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/mysql-connector-java-5.0.7-bin.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26449juddi-saaj.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/hsqldb-plugin.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossws-spi.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26416jboss-ejb3.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26437jboss-profiler.sar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/joesnmp.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jpl-pattern.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossws-native-jaxrpc.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26479mail-ra.rar-contents/mail-ra.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/autonumber-plugin.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/properties-plugin.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jbossws.sar/jbossws-management.war/WEB-INF/classes/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossjta-integration.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26476jboss-local-jdbc.rar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26445stax-api.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-remoting.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jbossmq.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-jsr88.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/ejb3-persistence.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/http-invoker.sar/invoker.war/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/bsh-deployer.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26480quartz-ra.rar-contents/quartz-ra.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26444policy.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jms/jbossmq-httpil.sar/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26474jboss-ha-local-jdbc.rar-contents/jboss-ha-
      ocal-jdbc.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/hsqldb.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26427jbossweb.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/juddi-service.sar/juddi.war/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26448xmlsec.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26431jstl.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/mina-core-2.0.0-M2.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/scheduler-plugin-example.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jboss-bean.deployer/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/mina-core-2.0.0-M3.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jboss-remoting-int.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26474jboss-ha-local-jdbc.rar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/conf/
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/quartz.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/tmp/deploy/tmp26426jbossweb-service.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/lib/jaxen.jar
       - file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/jboss-aop-jdk50.deployer/
      +++ org.jboss.system.server.NoAnnotationURLClassLoader@78a212
       - file:/C:/jboss/jboss-4.2.2.GA/lib/endorsed/serializer.jar
       - file:/C:/jboss/jboss-4.2.2.GA/lib/endorsed/xalan.jar
       - file:/C:/jboss/jboss-4.2.2.GA/lib/endorsed/xercesImpl.jar
       - file:/C:/jboss/jboss-4.2.2.GA/lib/jboss-jmx.jar
       - file:/C:/jboss/jboss-4.2.2.GA/lib/concurrent.jar
       - file:/C:/jboss/jboss-4.2.2.GA/lib/log4j-boot.jar
       - file:/C:/jboss/jboss-4.2.2.GA/lib/jboss-common.jar
       - file:/C:/jboss/jboss-4.2.2.GA/lib/jboss-system.jar
       - file:/C:/jboss/jboss-4.2.2.GA/lib/jboss-xml-binding.jar
      +++ sun.misc.Launcher$AppClassLoader@9fbe93
       - file:/C:/jboss/jboss-4.0.5.GAejb3/server/default/lite
       - file:/C:/Sun/AppServer/jdk/lib/tools.jar
       - file:/C:/jboss/jboss-4.2.2.GA/bin/run.jar
      +++ sun.misc.Launcher$ExtClassLoader@198dfaf
       - file:/C:/Sun/AppServer/jdk/jre/lib/ext/dnsns.jar
       - file:/C:/Sun/AppServer/jdk/jre/lib/ext/localedata.jar
       - file:/C:/Sun/AppServer/jdk/jre/lib/ext/sunjce_provider.jar
       - file:/C:/Sun/AppServer/jdk/jre/lib/ext/sunpkcs11.jar


      private static String getClassLoaders() {
       ClassLoader loader = Thread.currentThread().getContextClassLoader();
       StringBuffer buffer = new StringBuffer();
       boolean sawUnifiedClassLoader = false;
       do {
       buffer.append("+++ ");
       buffer.append(loader);
       buffer.append('\n');
       String loaderName = loader.getClass().getName();
       boolean isUCL = loaderName.startsWith("org.jboss.");
       // if (isUCL && sawUnifiedClassLoader == false) {
       if (isUCL) {
       sawUnifiedClassLoader = true;
       // Only add the UnifiedLoaderRepository.getURLs info once
       URL[] paths = null;
       try {
       Method getAllURLs = loader.getClass().getMethod("getAllURLs", new Class[0]);
       paths = (URL[]) getAllURLs.invoke(loader, new Object[0]);
       } catch (Exception e) {
       }
       int length = paths == null ? 0 : paths.length;
       for (int p = 0; p < length; p++) {
       buffer.append(" - ");
       buffer.append(paths[p]);
       buffer.append('\n');
       }
       } else if (loader instanceof URLClassLoader) {
       URLClassLoader uloader = (URLClassLoader) loader;
       URL[] paths = uloader.getURLs();
       int length = paths == null ? 0 : paths.length;
       for (int p = 0; p < length; p++) {
       buffer.append(" - ");
       buffer.append(paths[p]);
       buffer.append('\n');
       }
       }
       if (loader != null)
       loader = loader.getParent();
       } while (loader != null);
       // Write the call stack
       buffer.append("+++ Call stack:\n");
       Throwable t = new Exception("Don't panic, just a stack trace");
       StringWriter sw = new StringWriter();
       PrintWriter pw = new PrintWriter(sw);
       t.printStackTrace(pw);
       buffer.append(sw.toString());
       return buffer.toString();
       }