Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic