wjfelink / myschedule

Automatically exported from code.google.com/p/myschedule
0 stars 0 forks source link

Tomcat deploy logging error #35

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When deploying myschedule-2.3.0-SNAPSHOT.war in Tomcat server. We add 
slf4j-*.jar, and log4j*.jar into TOMCAT/lib to enable logging. But when 
starting up, we get this error (you will find the detail exception stack not on 
console, but in log file under TOMCAT/logs/localhost*.log

{{{
Oct 23, 2011 1:31:50 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class 
myschedule.web.WebAppContextListener
java.lang.LinkageError: loader constraint violation: when resolving method 
"org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;"
 the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of 
the current class, org/slf4j/LoggerFactory, and the class loader (instance of 
org/apache/catalina/loader/StandardClassLoader) for resolved class, 
org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type 
taticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory; used in the 
signature
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:284)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
    at myschedule.web.WebAppContextListener.<init>(WebAppContextListener.java:17)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at java.lang.Class.newInstance0(Class.java:372)
    at java.lang.Class.newInstance(Class.java:325)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:119)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
}}}

Original issue reported on code.google.com by saltnlight5 on 23 Oct 2011 at 5:37

GoogleCodeExporter commented 8 years ago
Fixed.

The myschedule will package both sl4j-api with sl4j-log4j12, but no 
log4j.properties will be package. 

The log4j.properties can be add to TOMCAT_HOME/lib and it will be pick up 
automatically. 

Original comment by saltnlight5 on 28 Oct 2011 at 2:29