Applies to: JBoss 4.0.5 GA

Everything started with a web application which worked perfectly inside a Tomcat 5 container and had to be migrated to JBoss. At the first deployment got this error:

14:45:56,496 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.spi.ErrorHandler" was loaded by 14:45:56,496 ERROR [STDERR] log4j:ERROR [WebappClassLoader  delegate: false  repositories:    /WEB-INF/classes/----------> Parent Classloader:java.net.FactoryURLClassLoader@172bab9] whereas object of type 14:45:56,497 ERROR [STDERR] log4j:ERROR "org.jboss.logging.util.OnlyOnceErrorHandler" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@19616c7].14:45:56,542 ERROR [STDERR] log4j:ERROR Could not create an Appender. Reported error follows.14:45:56,542 ERROR [STDERR] java.lang.ClassCastException: org.jboss.logging.appender.DailyRollingFileAppender

After searching the forums for a while I found this link according to which all I had to do is:

export JAVA_OPTS=-Dlog4j.defaultInitOverride=true

This solved indeed the error and I was quite happy to see the application running but I soon realised that in fact this fixed the problem as the error did not occured anymore but the log mechanism did not worked either.

After a lot more search I finally found the JBoss recomandation for this problem: all I had to do is to remove the log4j and commons-logging jars from the war file:

<war warfile.......<lib dir="${lib.dir}">	<include name="*.jar" />	<exclude name="log4j*.jar" />	<exclude name="commons-logging*.jar" /></lib>