aspose file tools
The moose likes Other Open Source Projects and the fly likes log4j -- NoClassDefFoundError: org/apache/log4j/Category Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "log4j -- NoClassDefFoundError: org/apache/log4j/Category" Watch "log4j -- NoClassDefFoundError: org/apache/log4j/Category" New topic
Author

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

Murtuza Akhtari
Ranch Hand

Joined: Aug 07, 2004
Posts: 108
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


---<br />SCJP 1.4
Murtuza Akhtari
Ranch Hand

Joined: Aug 07, 2004
Posts: 108
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 !!
Shreeya Joshi
Greenhorn

Joined: Nov 29, 2004
Posts: 6
Add log4j jar file to the classpath in your application server environment start up script.
 
 
subject: log4j -- NoClassDefFoundError: org/apache/log4j/Category
 
Threads others viewed
Configuring WSAD 51.1 to use filters--Help!
WebSphere5.0 DataSource5 Servlet Filter
GZipFilter inside JSP and WSAD 5.1.1
Servlet Filter not working in JDK1.3.1
WSAD 5.1: Failed to load servlet, NoClassDefFoundError
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com