• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

log4j -- NoClassDefFoundError: org/apache/log4j/Category

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have created a wrapper class for the log4j, so that my application remains oblivious of the logging API (which might change in the future for us).
My project structure is as such:
EJBProject -- ejb stuff
WEBProject -- web stuff
JAVAProject-- all other java classes.

I wanna implement logging across all of them. For this, I have copied the log4j.1.2.8.jar file into the WEB-INF/lib and I have the log4j.properties in the WEBProject/Java Source folder. My wrapper class is in JAVAProject.

Extra Questions : 1)What is the proper way to create dependencies in such a scenario?
2)Where would I put my log4j.properties file and the log4j1.2.8.jar file so that all projects can have access to it?
Currently I have added the log4j1.2.8.jar file in the JAVAProject's Libraries too.
When I execute my filter it gives me the following error :

Why would it even look for Category?? I thought that class was deprecated and replaced by Logger. BTW line no 34 where the error occurs in my filter is this


Please help
 
Murtuza Akhtari
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found that if i move my wrapper class to the WEBProject then the logging works for the classes/servlets in the WEBProject. I cannot import any classes from the WEBProject to my JAVAProject since the dependency hierarchy is not defined that way.

my JAVAProject cannot have any dependency on the EJB and WEB projects and anyway my Log-Wrapper should technically be in the JAVAProject. What would be the work-around? How should I put my classes/log4j.properties file/log4jjar file so that everything works fine?

Please Help !!
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add log4j jar file to the classpath in your application server environment start up script.
reply
    Bookmark Topic Watch Topic
  • New Topic