File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes java.lang.NoClassDefFoundError: org.apache.log4j.Logger  error in the Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "java.lang.NoClassDefFoundError: org.apache.log4j.Logger  error in the Application" Watch "java.lang.NoClassDefFoundError: org.apache.log4j.Logger  error in the Application" New topic
Author

java.lang.NoClassDefFoundError: org.apache.log4j.Logger error in the Application

sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear All,
I have added the log4j-1.2.9.jar file in the WEB-INF\lib.Also used the abclog4j.properties properties file.Could you please suggest me why i am getting this error(java.lang.NoClassDefFoundError: org.apache.log4j.Logger error) while started my server and running application through the URL.

Thanks for your time.

Regards
Sumanta Panda
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Make sure that another log4j jar isn't anywhere else on the server's classpath - i.e. in the server's lib directory, or referenced through the system environment (if the server is set up this way) - sometimes you'll get NoClassDefFoundError when there are conflicting versions of a class.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear Nathan,
I didn't get your advise regarding Log4j error properly.


We shouldn't mention log4j. jar in the server classpath(Yes/No).
We only keep the log4j. jar in the WEB-INF\lib(Yes/No)

Please rectify if my understanding is wrong.

Thanks for your understanding.

Regards
Sumanta
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Either one or the other - but not both.

The one that makes the most sense - to have the dependency in the webapp itself is :
log4j.jar located in:
server classpath(No)
WEB-INF\lib(Yes)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.NoClassDefFoundError: org.apache.log4j.Logger error in the Application