File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes ResourceBundle : MissingResourceException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "ResourceBundle : MissingResourceException" Watch "ResourceBundle : MissingResourceException" New topic
Author

ResourceBundle : MissingResourceException

Montano Mazvik
Greenhorn

Joined: Feb 07, 2007
Posts: 23
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

Joined: Dec 11, 2004
Posts: 13410

You didn't say where you put your properties file.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Montano Mazvik
Greenhorn

Joined: Feb 07, 2007
Posts: 23
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

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Feb 07, 2007
Posts: 23
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

Joined: Feb 07, 2007
Posts: 23
Can someone help me in this...??

Thanks in Advance !!
Anirudh Vyas
Ranch Hand

Joined: Oct 23, 2006
Posts: 93
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


Vyas, Anirudh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResourceBundle : MissingResourceException
 
Similar Threads
Struts portlet on liferay giving Null pointer exception
Trying to set custom ResourceBundle for c:if
Properties or Resource Bundle
Resourcebundle can not be found!
Servlet [servlet-name] is currently unavailable