Thursday, October 20, 2011
Wednesday, October 19, 2011
Solving log4j error on the deploy
Recently, I got the following error while deploying my Web-Service .war on Tomcat 6:
log4j:ERROR Could not instantiate class [org.jboss.logging.util.OnlyOnceErrorHandler].After little research, I found out that it was caused by the custom appender for log4j I have included in my project:
java.lang.ClassNotFoundException: org.jboss.logging.util.OnlyOnceErrorHandler
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.log4j.helpers.Loader.loadClass(Loader.java:160)
at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:309)
at org.apache.log4j.xml.DOMConfigurator.parseErrorHandler(DOMConfigurator.java:227)
at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:193)
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:94)
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">The easy solution to the problem was to add the following Maven dependency in my pom.xml:
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p [%c{6}] %m%n"/>
</layout>
</appender>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.4.8</version>
</dependency>
Thursday, October 13, 2011
Subscribe to:
Posts (Atom)