2 Replies Latest reply on Mar 27, 2007 10:00 AM by meissa sakho

    Log4j conflicts and classLoading nightmare in jboss 4.0.5

    meissa sakho Newbie

      Hi all,

      I'm seriousely tearing my hair off with jboss 4.0.5 classloding problems

      We're trying to migrate from jboss 4.0.3.SP1 to jboss 4.0.5.
      About 10 applications are concerned (all of them are ears) and each of them have their loader repository defined like below in jboss-app.xml file
      Each application has it own log4j.jar


      <jboss-app>
      <loader-repository>nis_portail:loader=my_appXloader</loader-repository>
      </jboss-app>


      When we start Jboss after putting webapps in deploy directory.
      We're getting the error messages below:

      log4j:ERROR A "org.jboss.logging.util.OnlyOnceErrorHandler" object is not assignable to a "org.apache.log4j.spi.ErrorHandler" variable.
      log4j:ERROR The class "org.apache.log4j.spi.ErrorHandler" was loaded by
      log4j:ERROR [org.jboss.mx.loading.UnifiedClassLoader3@7f30f8{ url=file:/D:/Documents/developpements/workspace/nis_portail_ear/deploy/portail_ear.ear/ ,addedOrder=48}] whereas object of type
      log4j:ERROR "org.jboss.logging.util.OnlyOnceErrorHandler" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@1a33d48].
      log4j:ERROR Could not create an Appender. Reported error follows.
      java.lang.ClassCastException: org.jboss.logging.appender.DailyRollingFileAppender
      at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:165)
      at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:140)
      at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:153)
      at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:415)
      at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:384)
      at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:783)
      at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:666)
      at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
      at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:602)
      at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:460)
      at org.apache.log4j.LogManager.(LogManager.java:113)
      at org.apache.log4j.Logger.getLogger(Logger.java:85)

      I've seen in the forum that a solution to solve this problem is to remove
      log4j.jar from application librairies.
      I would like to know if there is not another solution because some applications MUST use spécific log4j.jar versions to log properly.
      And all theses application worked fine with JBoss4.0.3SP1

      Any suggestion would be greatly appreciated.

      Meissa