Tuesday, September 1, 2009

JBoss and log4j

Recently I got the following error when deploying my JBoss Application.

log4j:ERROR Could not instantiate class [org.jboss.logging.util.OnlyOnceErrorHandler].
java.lang.ClassNotFoundException: org.jboss.logging.util.OnlyOnceErrorHandler

To see the problem was that the log4j and commons-logging jars which were already in JBoss was conflicting with the Jars I had on my war distribution. It was easily resolved after i removed the log4j and commons-logging jars from my war distribution and used those classes only to build the application because in runtime those jars are taken by defaults used within JBoss.