Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 17855 invoked from network); 17 Dec 2009 21:28:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Dec 2009 21:28:38 -0000 Received: (qmail 39836 invoked by uid 500); 17 Dec 2009 21:28:34 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 39788 invoked by uid 500); 17 Dec 2009 21:28:34 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 39777 invoked by uid 99); 17 Dec 2009 21:28:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Dec 2009 21:28:34 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [76.96.59.211] (HELO QMTA11.westchester.pa.mail.comcast.net) (76.96.59.211) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Dec 2009 21:28:31 +0000 Received: from OMTA04.westchester.pa.mail.comcast.net ([76.96.62.35]) by QMTA11.westchester.pa.mail.comcast.net with comcast id JKna1d00J0ldTLk5BMUBth; Thu, 17 Dec 2009 21:28:11 +0000 Received: from [192.168.1.107] ([67.191.176.66]) by OMTA04.westchester.pa.mail.comcast.net with comcast id JMUA1d0091SKzsb3QMUBGv; Thu, 17 Dec 2009 21:28:11 +0000 Message-ID: <4B2AA269.80804@christopherschultz.net> Date: Thu, 17 Dec 2009 16:28:09 -0500 From: Christopher Schultz User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: FileNotFoundException in Tomcat6.0 References: <26808548.post@talk.nabble.com> In-Reply-To: <26808548.post@talk.nabble.com> X-Enigmail-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kumaravel, 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/log4j.properties. 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("log4j.properties"); 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 loaded? > 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 log4j.properties 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAksqomkACgkQ9CaO5/Lv0PA7MQCgsLVY4bVhSW3ijmaTemfTb5OK 9m4An1gOgbdkFI7OYHqmRCMIXA/Zw2nI =eLMQ -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org