tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: FileNotFoundException in Tomcat6.0
Date Thu, 17 Dec 2009 21:28:09 GMT
Hash: SHA1


On 12/16/2009 4:39 AM, jkv wrote:
> I am using tomcat 6.0 and created a log4j configuration folder under
> WEB-INF/classes/ I have my log4j.jar file in WEB-INF/lib
> folder. I created a simple servlet where in the init method I have the
> following line
> PropertyConfigurator.configure("");

This method takes a filename. Since you've not provided a path to the
file, here, where did you put your file to ensure that it gets properly

> but this is throwing FileNotFoundException?? Should my properties file be in
> my class path?

That depends on how you configure log4j. We simply do this:

new PropertyConfigurator();

...and put into the CLASSPATH by dropping it into the
WEB-INF/classes directory in our webapp.

> Also I created a test setup by creating a sample test.txt
> file under WEB-INF/classes folder. When I open the file in my servlet I get
> the same FNF Exception??

What path are you using when you try to open the file? If you aren't
fully-specifying the path, then the path is relative. Relative to what?
Relative to the current working directory of the JVM process. What's the
CWD? It could be anything, though it tends to be either the CWD of the
parent process or CATALINA_BASE. You shouldn't have to worry about that,
though, because you should always fully-specify your file paths.

Better yet, load your file using the ClassLoader.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message