logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Friis <...@gavia.dk>
Subject Log4j and commons-logging unable to locate each other
Date Thu, 25 Oct 2007 16:01:22 GMT
Hello

I have a problem with log4j and commons-logging which i really hope anybody 
can help me with. 

Setup:
Windows 2000, Apache Tomcat 6.0, JRE 1.6.0_02, log4j-1.2.15, commons-logging 
annd i am using eclipse 3.3.0

Since i have multiple Web services on the same Tomcat server i have been 
putting log4j.jar in WEB-INF/lib and log4j.properties in WEB-INF/classes.

My problem is some kind of class-loading problem where log4j and 
commons-logging won't find each other.

2 scenarios:

1) commons-logging.jar and log4j.jar are both put in WEB-INF/lib for my 
webapp.

2) commons-logging.jar is put in tomcat 6.0/lib (Common classloader according 
to tomcat 6.0 doc) and log4j.jar in WEB-INF/lib.

The stacktraces of both scenarios are given below.

Question is: Why can't they see each other and how can i solve the problem ?

Can it really be so that i have to wrap the log4j class (as describe in the 
log4j book) and can someone explain why and will it help ?

Any feed back or solution hints are really appreciated :-)

Thx
Jon Friis

Scenario 1)
--------------------------------------------------

25-10-2007 16:47:24 org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /FAS threw load() exception
java.lang.NoClassDefFoundError: org.apache.commons.logging.LogFactory
        at 
org.apache.axis.components.logger.LogFactory.class$(LogFactory.java:45)
        at 
org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.java:41)
        at 
org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java:33)
        at 
org.apache.axis.transport.http.AxisServlet.<clinit>(AxisServlet.java:75)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at 
org.apache.axis.transport.http.AxisServletBase.class$(AxisServletBase.java:59)
        at 
org.apache.axis.transport.http.AxisServletBase.<clinit>(AxisServletBase.java:58)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1104)
        at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
        at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at 
org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
25-10-2007 16:47:25 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080

Scenario 2)
--------------------------------------------------

java.lang.NoClassDefFoundError: org/apache/log4j/Category
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.getConstructor(Class.java:1657)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370)
        at 
org.apache.axis.components.logger.LogFactory.getLog(LogFactory.java:37)
        at 
org.apache.axis.transport.http.AxisServlet.<clinit>(AxisServlet.java:75)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at 
org.apache.axis.transport.http.AxisServletBase.class$(AxisServletBase.java:59)
        at 
org.apache.axis.transport.http.AxisServletBase.<clinit>(AxisServletBase.java:58)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1104)
        at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
        at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at 
org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
25-10-2007 17:02:14 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080

-- 
Jon Friis
IT-Consultant & Owner

Gavia Technologies ApS
Omøgade 8, 2. sal
2100 Kbh. Ø

M: +45 23820053
E: jon_at_gavia.dk
W: www.gavia.dk

Join my network at 
http://www.linkedin.com/in/jonfriis


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message