• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem finding property file with Resource Bundle

 
Denis St-Amour
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
classes, not Classes. Case counts.
 
Denis St-Amour
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic