0

I am trying to load a message.properties file from a jar file, but it is not finding the file (and I have been trying for a few hours).

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
        <list>
            <value>messages/messages</value>
            <value>classpath:org/common/messages/messages</value>
        </list>
    </property>
</bean>

But it cannot find it:

[org.springframework.context.support.ResourceBundleMessageSource] (http-/0:0:0:0:0:0:0:0:8080-5) ResourceBundle [classpath:org/common/messages/messages] not found for MessageSource: Can't find bundle for base name classpath:org/common/messages/messages, locale en_US

I have tried the following, and it does load the file, which I assume means the file is on the classpath

ClassPathResource cpr = new ClassPathResource("org/common/messages/messages.properties");

What is the difference?

I am running this on JBoss.

Iain
  • 582
  • 5
  • 12
  • Check this : http://stackoverflow.com/questions/11150869/resourcebundle-not-found-for-messagesource-when-placed-inside-a-folder – Gyan Mar 20 '15 at 08:15

1 Answers1

2

Try this sample, from this POST - Spring UTF-8 message resource from external jar proglem

<bean id="propertiesMessageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:com/mypackage/i18n/messages" />
Community
  • 1
  • 1
Paul John
  • 1,626
  • 1
  • 13
  • 15