Announcement Announcement Module
Collapse
No announcement yet.
Unable to locate MessageSource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to locate MessageSource

    I've been getting this message time and time again while defining it inside the applicationContext.xml

    Following the countries example, i had only that bean defined inside the context, and the servlet beans in servletName-servlet.xml

    after two hours of frustration i copied exactly the same bean into the servlet config, commenting out the one in the "context" and it worked!

    applicationContext.xml
    Code:
    <beans>
    <!-- 
    	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">	
    		<property name="basename"><value>messages</value></property>										
    	</bean>
     -->
    </beans>
    servletName-servlet.xml
    Code:
    <beans>
    
    	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">	
    		<property name="basename"><value>messages</value></property>										
    	</bean>
    No reference to the contextConfigLocation in web.xml just like countries.

    I can't understand why countries load the messageSource inside the applicationContext.xml and not in servletName-servlet.xml like i did.

    thanks

    Fernando Racca

  • #2
    How do you load the applicationContext.xml? do you have any ContextLoaderListener / ContextLoaderServlet configured in web.xml.
    Also, can you post the exception you receive?
    I configure the ResourceBundleMessageSource inside applicationContext.xml and it works just fine.

    Comment


    • #3
      well, i wasn't using the ContextLoaderServlet, i forgot that.

      now i've put it in the web.xml and i was expecting for it to work. surprisingly enough, it didn't. the same message time and time again

      after a careful reding of the log, i've noted that applicationContext.xml was being initialized after servletName-servlet.xml, it had a race condition because the two servlets were put to load on startup at level 1.

      now it works perfectly

      thanks for your quick reply!

      Fernando Racca

      Comment

      Working...
      X