Neither, I didn't compile the resources with the jar file! should i?
if so how would i then access it? Also i don;t have a classes directory since my code is compiled and jarred and forms part of the WEB-INF/lib Thanks David Smith-2 wrote: > > So where exactly is your "resources/myFile.xml"? Is it in the > WEB-INF/classes directory of your webapp or a jar file in WEB-INF/lib? > Your method of access requires it be in one of those two places. > > --David > > nformosa wrote: > >> >>David Smith-2 wrote: >> >> >>>nformosa wrote: >>> >>> >>>>Hi All, >>>> >>>>I'm having trouble when deploying my WAR application. The War file >>>>contains >>>>mainly the WEB.xml, and index.html file and a number of required >>>>libraries, >>>>incudling the compiled src code i've written, All libraries are stored >>>>within the WEB-INF/libs which is correct. Along the libraries i have a >>>>folder called resources, which have a number of files used as properties >>>>files. >>>> >>>>The problem is that when i'm trying to access these files (property >>>>files) >>>>i'm givin a 'Not found' error, and mainly this is due to the fact that >>>>its >>>>looking in the bin folder of tomcat as its classpath! >>>> >>>>I'm accesing these files using relative paths ie: /resources/config.xml >>>> >>>>How can i fix this problem? any ideas would really be appreciated! >>>> >>>>thanks in advance >>>>Nick >>>> >>>> >>>> >>>What you are seeing with it referencing the bin directory is it >>>accessing the directory tomcat was started from. Depending on the >>>script, that can be virtually anywhere in the system. >>> >>>The servlet API provides ServletContext.getResourceAsStream( >>>webappRelPath ) for reading files in the webapp. If you placed the >>>properties files in either WEB-INF/classes or a .jar file, you should >>>also be able to do it with a Class.getResourceAsStream() method. >>> >>> >>>--David >>> >>> >>>--------------------------------------------------------------------- >>>To start a new topic, e-mail: users@tomcat.apache.org >>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >>> >> >> >> >>Hi again, >> >>Thanks for your help! >> >>Though i'm still having trouble..since the file is being accessed from a >>class not the servlet the ServletContext is not valid. Then i tried to print >>out the following: >> >>this.getClass().getClassLoader().getResource("resources/myfile.xml").getPath().toString()); >> >>but still the result is : d:\tomcat\bin\resources\myfile.xml >> >>If someone can give me a clearer idea it would be great.. >> >>Thanks once again >> >>Nick >> >> >> > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Tomcat---WAR-File--Classpath-not-recognised-for-properties-file-tf3940737.html#a11178320 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]