aspose file tools*
The moose likes Servlets and the fly likes Servlet Cannot find Find Properties File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Cannot find Find Properties File" Watch "Servlet Cannot find Find Properties File" New topic
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: 12836
    
    5
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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Cannot find Find Properties File