File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
srinivas Doni
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2905
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
srinivas Doni
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
Eclipse IDE Linux Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
Eclipse IDE Linux Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Srinivas,

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




hope works well....
 
Tommy Delson
Ranch Hand
Posts: 206
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.




 
chethan narayana
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.




 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic