wood burning stoves 2.0*
The moose likes Spring and the fly likes ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource" Watch "ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource" New topic
Author

ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource

srinivas Doni
Greenhorn

Joined: Jun 02, 2011
Posts: 23
Hi to all,


I am getting error
ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource: Can't find bundle for base name /WEB-INF/messageresource/welcome, locale en. Even though i put in source path, it is not recognizing the messageresource in spring.

if any one knows, help me to fix this error.


Thanks inadvance,

With Regards,
srini


Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

srinivas Doni wrote:
ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource: Can't find bundle for base name /WEB-INF/messageresource/welcome, locale en.

The error message is self explanatory, you've to keep the welcome.properties file in "WEB-INF/messageresource/" dir.
Try this.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
srinivas Doni
Greenhorn

Joined: Jun 02, 2011
Posts: 23
Hi Sagar Rohankar,

even i put in src folder, it raises same error.


can you help me step by step process for to find message properties file



Thanks in advance

With Regards,
srini
kunalkumar somani
Greenhorn

Joined: Jul 13, 2011
Posts: 7

Hi,

You need to configure message resouce bundle like below in xml file.

<bean id="resource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>filename without extension</value>
</list>
</property>
</bean>

<bean id="example" class="com.temp.Example">
<property name="messages" ref="messageSource"/>
</bean>

The File name which you provided that must be available in classpath. And because of that only you are getting this error "Can't find bundle for base name".

The Example class has below code

private MessageSource messages;

public void setMessages(MessageSource messages) {
this.messages = messages;
}

srinivas Doni
Greenhorn

Joined: Jun 02, 2011
Posts: 23
kunalkumar somani,

i put in message properties files in src folder and i copied these files in /web-inf/build/classes folder.

when i deploy project in tomcat server, again i am getting same error messge not found .
Actually problem is the request url
http://localhost:8080/SpringMVC/userForm.htm

when i append query string ?language=en_US to above url , then only it is working.
// userForm.jsp



//web.xml


// dispatch servlet.xml


Even i am sending form with method=get,
it does not append query string automatically, help me to resolve this error.

Thanks in advance
With Regards,
srini



kunalkumar somani
Greenhorn

Joined: Jul 13, 2011
Posts: 7

hi Srinivas,

You can use org.springframework.context.support.ReloadableResourceBundleMessageSource instead of org.springframework.context.support.ResourceBundleMessageSource.




hope works well....
Tommy Delson
Ranch Hand

Joined: Apr 13, 2011
Posts: 206
srinivas Doni wrote:Hi to all,


I am getting error
ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource: Can't find bundle for base name /WEB-INF/messageresource/welcome, locale en. Even though i put in source path, it is not recognizing the messageresource in spring.

if any one knows, help me to fix this error.


Thanks inadvance,

With Regards,
srini






After reviewing the error message I can tell that your bean "messageSource" is not probably configured.

Here a solution based on your configuration.

What you have: <property name="basename" value="/messageresource/welcome"/>

Problem: The problem is where you specified the value contents ""/messageresource/welcome" incorrectly, therefore, it can't find your property file.

Solution: Change to "<property name="basename" value="/WEB-INF/messages/messages" />" based on your configuration.

Your welcome.properties file must place in "/WEB-INF/messageresource/" directory in your webapp. The "welcome" is just a properties name or whatever you called follow after the directory.



Example,



Refer to Spring reference document if you need for info...hope it help.





OCPJP6-05-11
"Your life is in your hands, to make of it what you choose."
chethan narayana
Greenhorn

Joined: Jul 17, 2014
Posts: 1
Kudos it helped to resolve the issue of loading property file
thanks a ton
Tommy Delson wrote:
srinivas Doni wrote:Hi to all,


I am getting error
ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource: Can't find bundle for base name /WEB-INF/messageresource/welcome, locale en. Even though i put in source path, it is not recognizing the messageresource in spring.

if any one knows, help me to fix this error.


Thanks inadvance,

With Regards,
srini






After reviewing the error message I can tell that your bean "messageSource" is not probably configured.

Here a solution based on your configuration.

What you have: <property name="basename" value="/messageresource/welcome"/>

Problem: The problem is where you specified the value contents ""/messageresource/welcome" incorrectly, therefore, it can't find your property file.

Solution: Change to "<property name="basename" value="/WEB-INF/messages/messages" />" based on your configuration.

Your welcome.properties file must place in "/WEB-INF/messageresource/" directory in your webapp. The "welcome" is just a properties name or whatever you called follow after the directory.



Example,



Refer to Spring reference document if you need for info...hope it help.




 
wood burning stoves
 
subject: ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource