log4j gives strange exceptions in JBoss

When JBoss started to initialize my application, I got the following exceptions


ERROR [STDERR] log4j:ERROR Could not create an Appender. Reported error follows.
ERROR [STDERR] java.lang.ClassCastException: org.jboss.logging.appender.DailyRollingFileAppender
ERROR [STDERR]   at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:165)
ERROR [STDERR]   at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:140)

Now this is a maven application and I did not get this error a while back.
So what is happening?

After a lot of searching, it seems that my ear file was pulling in some extra files, and one of them probably contains a log4j.properties file… These were dependencies that were added in the pom file to allow automatic deployment (and database update when this is done). Solution is to assure the dependency is not included by setting the scope to “provided”.


        <dependency>
            <!-- need for "-Drun install" to have db update before starting jboss -->
            <groupId>be.myapp</groupId>
            <artifactId>myapp-ddltool</artifactId>
            <scope>provided</scope>
        </dependency>

Leave a Reply

Your email address will not be published. Required fields are marked *

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

*