If I only use log4j, jar has to be placed in my app's WEB-INF/lib. Don't
know why it is in a different directory if commons-logging and log4j work
together.

Regards,
 
 
Phillip Qin
 
"This Guy Thinks He Knows Everything"


-----Original Message-----
From: Paul Hodgetts [mailto:[EMAIL PROTECTED]] 
Sent: December 28, 2002 12:11 PM
To: [EMAIL PROTECTED]
Subject: Re: Problem Using Log4J and Commons Logging with Struts

Eddie Bush wrote:

 > Add two files to your WEB-INF/classes directory:
[...]
 > That should fix things, I believe.  The commons-logging package
 > is going to expect that you want to use Log4J if you have the
 > Log4J JAR in the classpath (ie your WEB-INF/lib directory).
 > It's not going to "work" correctly until you configure it
 > properly though (at least, it never has for me).

Thanks for the reply.  I tracked down what was happening.

The error was a NoClassDefFoundError on org/apache/log4j/Layout,
despite the fact that I have log4j-1.2.7.jar and log4j.properties
in the WEB-INF/lib directory.  So it looks like the server is
looking for Log4J as the web app is actually being loaded and
prior to the web app's jars being put in its classpath.

I put the jar and the properties file into the lib directory for
the server, in this case JRun puts them in jrun/servers/xxx/lib
(for a server named xxx).  Now it loads the web app properly
without the error.

I don't like this, because it means my web app can't be self-
contained and distributed just as the war.  I'd have to look at
the specs to see if JRun is behaving correctly by not putting the
web app's jars in the classpath prior to initializing the web app,
but even if it is behaving incorrectly, that's the way it works,
so I guess I have to deal with it.

I hope maybe this helps someone else...

Thanks to everyone who replied,
Paul
-----
Paul Hodgetts -- President, Principal Consultant
Agile Logic -- www.agilelogic.com
Consulting, Coaching, Training -- On-Site & Out-Sourced Development
Java, J2EE, C++, OOA/D -- Agile Methods/XP/Scrum, Use Cases, UI/IA


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

Reply via email to