I have a MessageResources.properties file that contains the text to be displayed on the labels and buttons in the form. Nonetheless, I got HTTP Status 500 and the problem is that the text provided in that file cannot be picked up - I think it results from not finding the file. I checked: 1. name of the file: it is a correct spelling 2. location of the file: it is in the correct directory 3. type of the file: the Windows Explorer shows the type of that file is a PROPERTIES file I need your experience to tell what else could go wrong. Please help.
Hi Jen, Are you trying to load the properties file thru a servlet? If so the problem could be that the servlet can't see a file on the host's file system. All it is going to be able to see are files in its virtual path. Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
JiaPei Jen
Ranch Hand
Joined: Nov 19, 2000
Posts: 1309
posted
0
The properties file is kept in the same directory with all compiled servlet class files. I am very frustrated by the problem.
[mods: plz move this thread to Servlets forum] I was totally frustrated with this for a while. I got intermittent behavior and figured out that when I start Tomcat from the directory containing .properties file, it worked. I think it has to do with the classloader finding it in that case. Fortunately, there's a much better solution than that. You must use Class.getResourceAsStream() so that tomcat can find the file. Here's an example: