Classloader, class NOT found and blacklisting.
danescott May 25, 2010 11:25 AMHi
I'd be grateful if somebody could explain what's happening on my JBoss 6 M1 application? I appear to have a classloader issue from a WAR file when attempting to load a class from an separate EAR/lib jar. The class loader is failing to load a utility class (LDAPLoginModule2.class) when starting the WAR.
This is a ported project from JBoss 4.2.3.GA that happily worked, I'm sure I must have made a mistake or failing to account for changes to the class loader.
Here's the TRACE from the server.log,
2010-05-24 12:21:42,790 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] (http-127.0.0.1-8080-1) BaseClassLoader@182dd60{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} load from domain com.xitca.security.LDAPLoginModule2 domain=ClassLoaderDomain@19e91fe{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} 2010-05-24 12:21:42,790 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@19e91fe{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} findLoader com/xitca/security/LDAPLoginModule2.class classLoader=BaseClassLoader@182dd60{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} allExports=false findInParent=true 2010-05-24 12:21:42,790 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@19e91fe{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} com/xitca/security/LDAPLoginModule2.class does NOT match parent beforeFilter=NOTHING_BUT_JAVA 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@19e91fe{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} class is black listed com/xitca/security/LDAPLoginModule2.class 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@19e91fe{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} not loading com/xitca/security/LDAPLoginModule2.class from imports it has no delegates 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@19e91fe{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} trying to load com/xitca/security/LDAPLoginModule2.class from requesting BaseClassLoader@182dd60{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] (http-127.0.0.1-8080-1) BaseClassLoader@182dd60{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} get resource locally com/xitca/security/LDAPLoginModule2.class 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] (http-127.0.0.1-8080-1) BaseClassLoader@182dd60{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} resource is blacklisted com/xitca/security/LDAPLoginModule2.class 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@19e91fe{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} com/xitca/security/LDAPLoginModule2.class matches parent afterFilter=<EVERYTHING> 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@19e91fe{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} load from parent com/xitca/security/LDAPLoginModule2.class parent=ClassLoaderDomain@1dfd90f{DefaultDomain} 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@1dfd90f{DefaultDomain} findLoader com/xitca/security/LDAPLoginModule2.class classLoader=null allExports=true findInParent=true 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@1dfd90f{DefaultDomain} com/xitca/security/LDAPLoginModule2.class matches parent beforeFilter=<EVERYTHING> 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@1dfd90f{DefaultDomain} load from parent com/xitca/security/LDAPLoginModule2.class parent=java.net.URLClassLoader@e5855a 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.plugins.loader.ClassLoaderToLoaderAdapter] (http-127.0.0.1-8080-1) Resource com/xitca/security/LDAPLoginModule2.class NOT found in java.net.URLClassLoader@e5855a 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@1dfd90f{DefaultDomain} class is black listed com/xitca/security/LDAPLoginModule2.class 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@1dfd90f{DefaultDomain} com/xitca/security/LDAPLoginModule2.class does NOT match parent afterFilter=<NOTHING> 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] (http-127.0.0.1-8080-1) ClassLoaderDomain@19e91fe{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} trying to load com.xitca.security.LDAPLoginModule2 using hack sun.misc.Launcher$AppClassLoader@1ba34f2 2010-05-24 12:21:42,791 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] (http-127.0.0.1-8080-1) BaseClassLoader@182dd60{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} unlock Thread[http-127.0.0.1-8080-1,5,jboss] holding=1 2010-05-24 12:21:42,792 TRACE [org.jboss.detailed.classloader.ClassLoaderManager] (http-127.0.0.1-8080-1) unregisterLoaderThread, classloader=BaseClassLoader@182dd60{vfsfile:/C:/jboss-6/server/default/deploy/XitcaOneModules/ApplicationContainer.war/} thread=Thread[http-127.0.0.1-8080-1,5,jboss] rescheduleTasks=true 2010-05-24 12:21:42,792 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.XitcaOne] (http-127.0.0.1-8080-1) Login failure javax.security.auth.login.LoginException: unable to find LoginModule class: com.xitca.security.LDAPLoginModule2 at javax.security.auth.login.LoginContext.invoke(Unknown Source) at javax.security.auth.login.LoginContext.access$000(Unknown Source) at javax.security.auth.login.LoginContext$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.login.LoginContext.invokePriv(Unknown Source) at javax.security.auth.login.LoginContext.login(Unknown Source) at org.jboss.security.plugins.auth.JaasSecurityManagerBase.defaultLogin(JaasSecurityManagerBase.java:553) at org.jboss.security.plugins.auth.JaasSecurityManagerBase.authenticate(JaasSecurityManagerBase.java:487) at org.jboss.security.plugins.auth.JaasSecurityManagerBase.isValid(JaasSecurityManagerBase.java:365) at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:160) at org.jboss.web.tomcat.security.JBossWebRealm.authenticate(JBossWebRealm.java:385) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source) 2010-05-24 12:21:42,792 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.XitcaOne] (http-127.0.0.1-8080-1) End isValid, false 2010-05-24 12:21:42,792 TRACE [org.jboss.web.tomcat.security.JBossWebRealm] (http-127.0.0.1-8080-1) User: is NOT authenticated 2010-05-24 12:21:42,792 TRACE [org.jboss.web.tomcat.security.JBossWebRealm] (http-127.0.0.1-8080-1) End authenticate, principal=null 2010-05-24 12:21:42,792 TRACE [org.jboss.security.SecurityRolesAssociation] (http-127.0.0.1-8080-1) Setting threadlocal:null 2010-05-24 12:21:42,793 TRACE [org.jboss.security.SecurityRolesAssociation] (http-127.0.0.1-8080-1) Setting threadlocal:nul
The WAR file is located at %JBOSS_HOME%/server/default/deploy/XitcaOneModules/ApplicationContainer.war, it looks like this:
META-INF MANIFEST.MF WEB-INF context.xml jboss-web.xml web.xml splashscreen.jpg AC_OETags.js application.ico ApplicationContainer.html ApplicationContainer.swf ApplicationContainerStyles.swf ClientNexus.swf history.htm history.js history.swf nexus.js playerProductInstall.swf
The ApplicationContainer.war file contains the following jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?> <jboss-web> <security-domain>java:/jaas/XitcaOne</security-domain> <context-root>XitcaOne</context-root> </jboss-web>
The EAR/lib/Security.jar (which contains the LDAPLoginModule2.java) is located at %JBOSS_HOME%/server/default/deploy/XitcaOne.EAR, it looks like this:
META-INF/ META-INF/MANIFEST.MF META-INF/application.xml META-INF/jboss-app.xml OracleQueue.sar NOSProcessListener.sar TS.jar US.jar EV.jar WMS.jar ojdbc14.jar lib/ lib/General.jar lib/Security.jar
The XitcaOne.EAR/META-INF/jboss-app.xml looks like:
<?xml version='1.0' encoding='UTF-8' ?> <jboss-app> <module-order>strict</module-order> <security-domain>java:/jaas/XitcaOne</security-domain> <module><service>OracleQueue.sar</service></module> <module><service>NOSProcessListener.sar</service></module> </jboss-app>
Am I missing some kind of loader xml block in the jboss-web.xml or configuration to resolve the right class loader?
Many thanks for any help given.
Kind Regards
Dan Escott.