• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat Cannot Find The properties File

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to run my first Struts -- using the tutorial "Login" example at http://www.javaranch.com/newsletter/Mar2002/newslettermar2002.jsp#struts
There is a MessageResources.properties file that allows for all strings displayed in an application to be defined. Nonetheless, After I
entered http://localhost:8080/struts/jsp/LoginView.jsp
in the browser address bar, I got HTTP Status 500. I know that the LoginView.jsp file was found; otherwise, I would have gotten HTTP Status 404 -- LoginView file not found error.
The problem is that the text provided in the MessageResources.properties file could not be picked up - I think that it is because the Tomcat cannot find the MessageResources.properties file.
I have checked MessageResources.properties:
1. name of the file: spelling is correct
2. location of the file: it is in the directory together with all compiled servlet class files; i.e. c:\tomcat\webapps\struts\WEB-INF\classes\test\struts
3. type of the file: the Windows Explorer shows the type of the
MessageResources.properties file is a PROPERTIES File
The contents of the web.xml file that is in the c:\tomcat\webapps\struts\WEB-INF directory is shown below:

I need your experience in telling what else could go wrong. Please help.
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Windows users often forget that Java is picky about capitalization in filenames in cases where Windows itself doesn't care. But it looks like you did all that correctly.
I would double-check the log files to see if the 500 error was in fact due to inability to locate the resource and not something else. Also, don't accept Window's affirmation that just because Windows says it's a properties file that it really is. The actual determinant is that the filename ends with ".properties".
Since I can't see anything obviously wrong, if none of the above helps, check to make sure that the property name within the properties file is spelled and capitalized exactly as you invoke it in the JSP. Sometimes I find it useful to have someone double-check for me, since I have been known to see what "should" be there and not what actually is there.
 
reply
    Bookmark Topic Watch Topic
  • New Topic