Results 1 to 3 of 3

Thread: Unable to locate MessageSource

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Location
    Los Buenos Aires de Madrid
    Posts
    2

    Default 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
    Do the simplest thing that could possibly work. - Kent Beck
    Everything should be made as simple as possible, but not simpler. - Albert Einstein

  2. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    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.
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

  3. #3
    Join Date
    Aug 2004
    Location
    Los Buenos Aires de Madrid
    Posts
    2

    Default

    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
    Do the simplest thing that could possibly work. - Kent Beck
    Everything should be made as simple as possible, but not simpler. - Albert Einstein

Similar Threads

  1. Replies: 32
    Last Post: Jul 20th, 2006, 01:37 PM
  2. Beandoc crashing (on its samples!)
    By aaime in forum Container
    Replies: 17
    Last Post: Oct 7th, 2005, 07:21 AM
  3. PerformanceMonitorInterceptor
    By tnist in forum AOP
    Replies: 3
    Last Post: Aug 24th, 2005, 01:39 PM
  4. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM
  5. Replies: 2
    Last Post: Aug 15th, 2004, 05:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •