2 Replies Latest reply on Jun 11, 2007 1:24 AM by Reinhard Graf

    Classloader problem with log4j

    Reinhard Graf Newbie

      Hi,

      I want to have my own log4j.xml in my application. Therefore I implemented a RepositorySelector as suggested in
      the JBoss documentation.
      But on startup I get following error:

      java.lang.NoSuchMethodError: org.apache.log4j.spi.RootCategory.(Lorg/apache/log4j/Priority;)V
      at com.soultec.trueAct.logger.AppRepositorySelector.init(AppRepositorySelector.java:47)
      at com.soultec.trueAct.listener.ContextListener.contextInitialized(ContextListener.java

      in the <JBOSS_HOME>/server/defautl/lib folder, there is the log4j-1.2.13.jar.
      But it seems, that the JBoss uses the log4j-boot.jar from the <JBOSS_HOME>/lib folder.

      Here is the structure of my ear-file:

      MyApp.ear
      + MyApp.war
      + META-INF
      + myjar.jar

      The RepositorySelector is initialized in a ServletContextListener which is in myjar.jar.

      In my application.xml i have an entry

      <module><java>myjar.jar</java></module>

      Please can somebody help me ?

      Here is the output of the jmx-console:

      org.apache.log4j.spi.RootCategory Information
      Repository cache version:
      org.apache.log4j.spi.RootCategory(1506dc4).ClassLoader=org.jboss.system.server.NoAnnotationURLClassLoader@10f6d3
      ..org.jboss.system.server.NoAnnotationURLClassLoader@10f6d3
      ..sun.misc.Launcher$AppClassLoader@a39137
      ....file:/C:/Java/jdk1.5.0_09/lib/tools.jar
      ....file:/C:/Java/jboss-4.0.5.GA/bin/run.jar
      ..sun.misc.Launcher$ExtClassLoader@92e78c
      ....file:/C:/Java/jdk1.5.0_09/jre/lib/ext/dnsns.jar
      ....file:/C:/Java/jdk1.5.0_09/jre/lib/ext/localedata.jar
      ....file:/C:/Java/jdk1.5.0_09/jre/lib/ext/sunjce_provider.jar
      ....file:/C:/Java/jdk1.5.0_09/jre/lib/ext/sunpkcs11.jar
      ++++CodeSource: (file:/C:/Java/jboss-4.0.5.GA/lib/log4j-boot.jar )
      Implemented Interfaces:

      ### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@2c9103{ url=null ,addedOrder=2}


      ### Instance1 via UCL: org.jboss.system.server.NoAnnotationURLClassLoader@10f6d3




      Regards

      Reinhard