tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Adams" <b...@satx.rr.com>
Subject RE: resource files not found in /WEB-INF/classes
Date Wed, 13 Feb 2002 03:25:39 GMT
stop start the tomcat process and truy again :)
if (works)
 unitTestingPassed = true;
else
 unitTestingPassed = false;

:)


-----Original Message-----
From: Michael Kintzer [mailto:MichaelK@ViAir.com]
Sent: Tuesday, February 12, 2002 9:22 PM
To: 'Tomcat Users List'
Subject: RE: resource files not found in /WEB-INF/classes


Thanks Brian.  I went through and tried all of:

File f = new File("../webapps/mywebapp/WEB-INF/classes/config.properties");
File f = new File("webapps/mywebapp/WEB-INF/classes/config.properties");
File f = new File("mywebapp/WEB-INF/classes/config.properties");
File f = new File("WEB-INF/classes/config.properties");
File f = new File("classes/config.properties");
File f = new File("config.properties");

on separate iterations.  The first five threw exceptions, and the last one
worked, which blew my mind, since that was what I had originally (and it
wasn't working, hence the original email).   Something getting cached
somewhere?  I use Tomcat Manager to reload the application each time I
redeploy the files.

It's working, but I don't trust it to stay that way.

Michael

-----Original Message-----
From: Brian Adams [mailto:bigb@satx.rr.com]
Sent: Tuesday, February 12, 2002 7:02 PM
To: Tomcat Users List
Subject: RE: resource files not found in /WEB-INF/classes


try putting

	File f = new
File("webapps/mywebapp/WEB-INF/classes/config.properties");

or
	File f = new
File("../webapps/mywebapp/WEB-INF/classes/config.properties");
(in case path is in bin from startup)

BTW, I put mine in WEB-INF only not in classes....but that is me and I am
not a standard. :)




-----Original Message-----
From: Michael Kintzer [mailto:MichaelK@ViAir.com]
Sent: Tuesday, February 12, 2002 8:57 PM
To: Tomcat Users List (E-mail)
Subject: resource files not found in /WEB-INF/classes


Tomcat 4.0.1: According to tomcat-docs/appdev/deployment.html,
webapps/mywebapp/WEB-INF/classes/ is the appropriate location for any
associated resource files required for an application "mywebapp".  I have
placed a properties file "config.properties" in my /WEB-INF/classes/
directory but when I try to access it using this code:

package com.myco.myproj

.. imports and other code...

try
{
	File f = new File("config.properties");
	FileInputStream fis = new FileInputStream(f);
	Properties prop = new Properties();
	prop.load(fis);
}
catch (Exception e)
{
	e.printStackTrace();
}

I continually get java.io.FileNotFoundException: config.properties (The
system cannot find the file specified).

I even tried adding a context element in my conf/server.xml file for my web
app like so:

<!-- myproj context -->
	<Context path="/myproj" docBase="myproj" debug="0" reloadable="true"
/>

but that had no effect.    I've searched through all the documentation I
could find and it all seems to indicate that any resource files in
/WEB-INF/classes should be detectable.  Any ideas on what I may be doing
incorrectly would be greatly appreciated.

Thanks,


Michael Kintzer




--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message