Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

class not found exception with log4j.jar

20 views
Skip to first unread message

Syed Arshad

unread,
Jan 21, 2004, 2:41:38 PM1/21/04
to

We tried to use the log4j for our logging service through a war, the log4j.jar
is bundled with war file and is availbale under /web-inf/lib/log4j.jar. The delpoyment
of the war is good but when we access any resource, which refers the log4j class
(Logger), it throws exception Logger class not found exception. Interstngly, the
application loads other jars from the lib like commons.jar, which we wanted to
use later as a wrapper, I don't have any clue why this is happening. Your help
is highly appreciated. Thanks.

<Jan 21, 2004 2:21:21 PM EST> <Info> <HTTP> <101209> <testlog:testlog ready>
<Jan 21, 2004 2:21:21 PM EST> <Info> <HTTP> <101208> <testlog:testlog starting>
<Jan 21, 2004 2:21:21 PM EST> <Info> <HTTP> <101047> <[ServletContext(id=6370863
,name=testlog,context-path=/testlog)] WebServiceServlet: init>
<Jan 21, 2004 2:21:21 PM EST> <Info> <Deployer> <149033> <activated application
testlog on myserver>
<Jan 21, 2004 2:21:21 PM EST> <Info> <Deployer> <149039> <Completing a deploymen
t task with id 3 for application testlog with status Completed>
<Jan 21, 2004 2:21:35 PM EST> <Error> <HTTP> <101250> <[ServletContext(id=637086
3,name=testlog,context-path=/testlog)]: Servlet class com.wellsfargo.cts.cdo.esi.c
mpcdu.ControllerServlet for servlet CmpCduServlet could not be loaded because
a
class on which it depends was not found in the classpath C:\bea\user_projects\my
domain\applications\testlog.war;C:\bea\user_projects\mydomain\.\myserver\.wlnotde
lete\testlog_testlog_6370863\jarfiles\WEB-INF\lib\commons-logging22179.jar;C:\bea\
user_projects\mydomain\.\myserver\.wlnotdelete\testlog_testlog_6370863\jarfiles\cl
s22178.jar.
java.lang.NoClassDefFoundError: org/apache/log4j/Logger>
<Jan 21, 2004 2:21:35 PM EST> <Error> <HTTP> <101018> <[ServletContext(id=637086
3,name=testlog,context-path=/testlog)] Servlet failed with ServletException
javax.servlet.ServletException: [ServletContext(id=6370863,name=testlog,context-p
ath=/testlog)]: Servlet class com.wellsfargo.cts.cdo.esi.cmpcdu.ControllerServlet
for servlet CmpCduServlet could not be loaded because a class on which it depen
ds was not found in the classpath C:\bea\user_projects\mydomain\applications\log
4j2.war;C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\testlog_testlog_6370
863\jarfiles\WEB-INF\lib\commons-logging22179.jar;C:\bea\user_projects\mydomain\
.\myserver\.wlnotdelete\testlog_testlog_6370863\jarfiles\cls22178.jar.
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:701)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
java:447)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:287)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:5360)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2468)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
>


Syed Arshad

unread,
Jan 21, 2004, 2:57:44 PM1/21/04
to

BTW, the environment info is: log4j: 1.2.8, WLS: 7.0 sp1

Robert Greig

unread,
Jan 21, 2004, 4:08:34 PM1/21/04
to
Syed Arshad wrote:

>>of the war is good but when we access any resource, which refers the
>>log4j class
>>(Logger), it throws exception Logger class not found exception. Interstngly,
>>the
>>application loads other jars from the lib like commons.jar, which we
>>wanted to
>>use later as a wrapper, I don't have any clue why this is happening.
>>Your help
>>is highly appreciated. Thanks.

I have two guesses:

1) Is your log4j.jar file named log4j-1.2.8.jar? If so, try renaming it
to "log4j.jar". I seem to recall with WLS 7.0 there is some ridiculous
bug where it fails to unpack that jar file from the WAR in some cases.
Bizarre I know but I definitely had this problem with one particular WLS
version and it was more obviously with log4j since by default it comes
with the version number in the distribution jar file.

2) Alternatively, is it a classloader issue. Is your app contained
entirely in the WAR? Or do you have some EJBs or have you even put some
classes in the WLS classpath? If so that could cause a problem since a
parent classloader cannot see classes in child classloaders. That means,
for example, that a class in the EJB classloader cannot see classes in
the web app classloader.

Robert

Syed Arshad

unread,
Jan 21, 2004, 5:07:29 PM1/21/04
to

Great Robert, It works and thanks a lot and nice to hear about this bug, it is
an intersting bug from WLS!

thanks,
Arshad

0 new messages