Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResourceBundle : MissingResourceException

 
Montano Mazvik
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting following exception when I try to load properties file using resource bundle into the init() method of my servlet which is
<onloadstartup>1<onloadstartup>.

My servlet code:

prop = new Properties();
ResourceBundle conf = ResourceBundle.getBundle("com.bba.mir.RegisteredCacheElements.properties");



Failed to load servlet: java.util.MissingResourceException: Can't find bundle for base name com.hsbc.us.mir.RegisteredCacheElements.properties, locale en_US


[BPSouther: Removed URGENT from post or subject line.]
[ March 26, 2008: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't say where you put your properties file.
 
Montano Mazvik
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ben,

have Kept the file into the JavaSource folder under the package "com.bba.mir"

I tried keeping it under the resources folder but didn't work !!

pls suggest.

Thanks.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaSource isn't part of the directory structure in a Java webapp.

In order for the container to find it it needs to be under the WEB-INF/classes/ directory or in a jar in WEB-INF/lib; with the proper package directories, of course.
 
Montano Mazvik
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben,

I am using RAD6.0 & I can see that properties file under

WEB-INF/classes/com/bba/mir/RegisteredCacheElements.properties

but still it is not getting loaded...!!
[ March 26, 2008: Message edited by: Montano Mazvik ]
 
Montano Mazvik
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone help me in this...??

Thanks in Advance !!
 
Anirudh Vyas
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if i am late or not;

com.bba.mir.RegisteredCacheElements <--- use this instead of
com.bba.mir.RegisteredCacheElements.properties in getBundle


there you go problem solved.


Regards
Vyas, Anirudh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic