aspose file tools*
The moose likes Servlets and the fly likes Problem finding property file with Resource Bundle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem finding property file with Resource Bundle" Watch "Problem finding property file with Resource Bundle" New topic
Author

Problem finding property file with Resource Bundle

Denis St-Amour
Greenhorn

Joined: Jun 02, 2011
Posts: 6
Hi,

I would like to use property files to handle error messages but when I try to access my property file using Resource Bundle I get the following error message:

java.util.MissingResourceException: Can't find bundle for base name Messages, locale en

I am relatively new to java and I'm not sure if I'm missing code. I am testing this web application using Weblogic 10.3. Any help would be much appreciated.


Here is what I have:

WAR file

WEB-INF/classes/Test/test.class
WEB-INF/classes/Messages_en.properties
Messages_fr.properties

Messages_en.properties:

100 = Please enter valid username and/or password

test.java:

java.util.*;

...

Locale locale = new Locale("en");

ResourceBundle rb = ResourceBundle.getBundle("Messages", locale);

...

testSession.setMessage(rb.getString("100"));

test.jsp:

<p>
<% if (testSession.getActionCode() == ActionConstants.ULGN_LOGON) {%>
<div class="span-4 background-light">
<p><%= testSession.getMessage() %></p>
</div>
<% } %>
</p>

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

classes, not Classes. Case counts.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Denis St-Amour
Greenhorn

Joined: Jun 02, 2011
Posts: 6
Bear Bibeault wrote:classes, not Classes. Case counts.


Made an error when copying the directory. The classes folder was lower-case. I made the corrections above. I had messages_en.properties inside classes\properties folder before but I moved it up one level thinking that maybe it would find it but I still receive the same error message regardless.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem finding property file with Resource Bundle