File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes log4j commons-logging problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "log4j commons-logging problem." Watch "log4j commons-logging problem." New topic

log4j commons-logging problem.

lee kris
Ranch Hand

Joined: Mar 30, 2005
Posts: 35
I have a problem with the log4j logging framework.
I followed the steps for coniguring the log4J and have the commons-logging.jar in my my /lib folder and the in the /WEB-INF/class folder.
now when i import in some of my java files and then compile, i get "package does not exist" error. the imports are as follows:

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

everything seems to be in place as far as configuration goes but i do not know why the package is not being recongnized. can anyone suggest some silly mistakes that I might be making?
Thank you for your suggestions in advance and have a great day.
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
Having the jar in your web-inf lib is one of the ways to use it in your app, but, having it there doesn't tell javac where it is, you'll still need to add it to your classpath arg for javac to find it.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Putting a jar file in WEB-INF/lib allows the application server to find the class as runtime, but it doesn't necessarily put the jar file in the compile time classpath. Check to see that your WEB-INF/lib/commons-logging.jar is in your classpath at compile time.

Consultant, Sima Solutions
lee kris
Ranch Hand

Joined: Mar 30, 2005
Posts: 35
to Ray Stojonic and Merrill Higginson,
Thank you both for the immediate response. I knew it was something silly. Now it is compiling correctly.
I agree. Here's the link:
subject: log4j commons-logging problem.
It's not a secret anymore!