File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Java Products and Servers and the fly likes Using log4j in EAR module Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Using log4j in EAR module" Watch "Using log4j in EAR module" New topic

Using log4j in EAR module

nosaku NSK

Joined: Apr 20, 2004
Posts: 1
I am having an enterprise application which contains a WAR and EJB JAR modules. Both the modules make use of log4j logging. The WAR module makes use of Struts framework.
So I kept the Struts related jar files in WEB-INF/lib and the libraries used by EJB JAR like log4j.jar, ibatis.jar, classes12.jar etc. in the EJB JAR file and added them to the Class-Path of the MANIFEST.MF of EJB JAR.
Now when I deploy the EAR, the ActionServlet of Struts is throwing an exception saying that the org.apache.log4j.Layout class is not found. I have event used the class-loader delegate="true" in the sun-web.xml. From the web components like JSPs I am able to refer to classes mentioned in the Class-Path of EJB JAR. But I am not able to find out what is the problem with the "log4j.jar" and why only this file is giving problem.
Can anyone please help?
Jose Zaleta

Joined: Mar 04, 2004
Posts: 15
Hello Nosaku,
I found some reference in a SUN forum that says that SUN has a problem (bug) when using log4j. The way I solved it was putting the log4j.jar in the server's classpath EXPLICITLY.
I hope this helps. Good luck.

David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
I also had an issue with Log4j and placing it in the AS7 CLASSPATH didn't solve our issue. Where do you put the Log4J .properties file? AS7 needs to find it on start and can't. I've tried several different locations and it simply wouldn't find it.

I eventually had to remove it completely to stop AS7 from throwing exceptions.
I agree. Here's the link:
subject: Using log4j in EAR module
It's not a secret anymore!