Forums Register Login

Servlet Cannot find Find Properties File

+Pie Number of slices to send: Send
The problem occurs when attempting to load a properties file in a servlet.

The batch job works OK. So I cut and paste the batch driver (GBTest01) into the servlet.

The servlet fails :


What's missing ? Thank you for any help.

The Properties File Directory :


The Classpath : C:\apache-tomcat-6.0.18\webapps\GBForms is in the classpath (the batch program found it).

The Batch Driver :

The Properties File Loader : used by batch and servlet

The Servlet :
+Pie Number of slices to send: Send
1. Servlet containers like Tomcat ignore your environment CLASSPATH - look at the class-loader-howto.html file normally installed with Tomcat in the "docs" under webapps.

2. The servlet API provides a mechanism for locating files in the web application. See javax.servlet.ServletContext API for methods like getContextPath, getRealPath.

Bill
+Pie Number of slices to send: Send
Thank you for your reply.
By tinkering around I found that placing the properties file in WEB-INF/classes works.
I will read the documentation.
Graeme.
He does not suffer fools gladly. But this tiny ad does:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2923 times.
Similar Threads
Not able to update or save a object to database. please help.
Retrive a property from a .properties file to JSP custom tag
below code work in command line. but it doesn't work in eclipse.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:06:00.