| Author |
Servlet Cannot find Find Properties File
|
Graeme Byers
Ranch Hand
Joined: Apr 16, 2004
Posts: 127
|
|
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 :
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
|
|
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
|
Java Resources at www.wbrogden.com
|
 |
Graeme Byers
Ranch Hand
Joined: Apr 16, 2004
Posts: 127
|
|
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.
|
 |
 |
|
|
subject: Servlet Cannot find Find Properties File
|
|
|