0 Replies Latest reply on Feb 28, 2005 9:27 AM by viz

    The mysteries of JBoss and classloaders

    viz Newbie

      Does JBoss (4.0.1) handle applications (with regards to classloading) that are deployed as an EAR/WAR (i.e. archived) differently from applications that are deployed exploded (unarchived)?

      I seem to be having some issues in this area. My application works fine either exploded or archived, but I get some exceptions when archived which seem to point to issues to do with the way JBoss loads classes - the issues are to do with Log4j.

      My application is configured to use its own log4j.jar and log4j.xml, with logging being directed to a separate log file. When the application is deployed exploded (unarchived) log4j works just fine. When the application is packaged (archived), log4j in the application stops working and throws an Exception - the applications continues to work just fine.

      14:01:33,906 INFO [STDOUT] log4j:ERROR A "org.jboss.logging.util.OnlyOnceErrorHandler" object is not assignable to a "org.apache.log4j.spi.ErrorHandler" variable.
      14:01:33,906 INFO [STDOUT] log4j:ERROR The class "org.apache.log4j.spi.ErrorHandler" was loaded by
      14:01:33,906 INFO [STDOUT] log4j:ERROR [org.jboss.mx.loading.UnifiedClassLoader3@755df3{ url=file:/C:/jboss-4.0.1/server/default/tmp/deploy/tmp27195Voice.ear ,addedOrder=39}] whereas object of type
      14:01:33,906 INFO [STDOUT] log4j:ERROR "org.jboss.logging.util.OnlyOnceErrorHandler" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@129f3b5].
      14:01:34,015 INFO [STDOUT] log4j:ERROR Could not create an Appender. Reported error follows.
      14:01:34,015 INFO [STDOUT] java.lang.ClassCastException
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:165)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:140)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:153)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:415)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:384)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:783)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:666)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:602)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:460)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.LogManager.(LogManager.java:113)
      14:01:34,015 INFO [STDOUT] at org.apache.log4j.Logger.getLogger(Logger.java:94)
      14:01:34,015 INFO [STDOUT] at forest.application.voice.dao.OracleVoiceDAO.(OracleVoiceDAO.java:22)
      14:01:34,015 INFO [STDOUT] at forest.application.voice.dao.OracleDAOFactory.getVoiceDAO(OracleDAOFactory.java:19)
      14:01:34,015 INFO [STDOUT] at forest.application.voice.facade.ServiceFacade.addSubject(ServiceFacade.java:47)
      14:01:34,015 INFO [STDOUT] at forest.application.voice.test.servlet.ServiceFacadeTestServlet.addSubject(ServiceFacadeTestServlet.java:35)
      14:01:34,015 INFO [STDOUT] at TestServiceFacade.testGetServiceFacadeInstanceOK(TestServiceFacade.java:46)
      14:01:34,015 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      14:01:34,031 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      14:01:34,031 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      14:01:34,031 INFO [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source)
      14:01:34,031 INFO [STDOUT] at junit.framework.TestCase.runTest(TestCase.java:154)
      14:01:34,031 INFO [STDOUT] at junit.framework.TestCase.runBare(TestCase.java:127)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
      14:01:34,031 INFO [STDOUT] at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
      14:01:34,031 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      14:01:34,031 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      14:01:34,031 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      14:01:34,031 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      14:01:34,031 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      14:01:34,031 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      14:01:34,031 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      14:01:34,031 INFO [STDOUT] at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      14:01:34,031 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
      14:01:34,031 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
      14:01:34,031 INFO [STDOUT] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
      14:01:34,031 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      14:01:34,046 INFO [STDOUT] at java.lang.Thread.run(Unknown Source)
      14:01:34,046 INFO [STDOUT] log4j:ERROR Could not parse input source [org.xml.sax.InputSource@1d4f6b4].
      14:01:34,046 INFO [STDOUT] java.lang.NullPointerException
      14:01:34,046 INFO [STDOUT] at java.util.Hashtable.put(Unknown Source)
      14:01:34,046 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:141)

      Any thoughts would be appreciated.