Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Message Bundle - No Message Found exception

  1. #1
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    18

    Default Message Bundle - No Message Found exception

    Hi friends,
    I m getting following exception when trying to use message bundle. I dont know if spring is able to find my message, which is in class folder of app.

    EXCEPTION:
    ===========
    org.springframework.context.NoSuchMessageException : No message found under code 'educationperiod.invalid.leapday.period.day' for locale 'en_US'.
    org.springframework.context.support.DelegatingMess ageSource.getMessage(DelegatingMessageSource.java: 77)
    org.springframework.context.support.AbstractApplic ationContext.getMessage(AbstractApplicationContext .java:630)
    org.springframework.web.servlet.support.RequestCon text.getMessage(RequestContext.java:492)
    org.springframework.web.servlet.support.BindStatus .getErrorMessages(BindStatus.java:172)
    org.springframework.web.servlet.support.BindStatus .<init>(BindStatus.java:125)
    org.springframework.web.servlet.tags.BindTag.doSta rtTagInternal(BindTag.java:115)
    org.springframework.web.servlet.tags.RequestContex tAwareTag.doStartTag(RequestContextAwareTag.java:6 8)
    org.apache.jsp.WEB_002dINF.jsp.main.setupperiod_js p._jspService(org.apache.jsp.WEB_002dINF.jsp.main. setupperiod_jsp:146)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:99)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:325)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.springframework.web.servlet.view.InternalResou rceView.renderMergedOutputModel



    Above exception occurs when I try to display errors through
    <c:forEach items="${status.errorMessages}" var ="errorMessage">
    <font color=red><c:out value="${errorMessage}" /><br></font>
    </c:forEach>
    .

    My Message bundle
    ==============
    school_en_US.properties
    -----------------------------
    educationperiod.invalid.normalday.period.day = Date cannot be greater than 28 for normal year
    educationperiod.invalid.leapday.period.day = Date cannot be greater than 29 for leap year



    Please kindly help to resolve the issue.
    Thanks !!!

    Aru K

  2. #2

    Default

    Is your resource bundle defined as message source in your servlet definition?

    Simon

  3. #3
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    18

    Default

    Yes friend.

    It is:

    <!-- Message resource declaration -->
    <bean id="messageResource" class="org.springframework.context.support.Resourc eBundleMessageSource">
    <property name="basename">
    <value>school</value>
    </property>
    </bean>


    Please help to solve this issue.

    Thanks,
    Aru K

  4. #4
    Join Date
    Oct 2006
    Posts
    1

    Default

    Isn't it supposed to be <bean id="messageSource"

  5. #5

    Default

    I had a similar issue. I used classpath:. I believe that resolved it. And I do believe the id needs to be "messageSource" as already stated.

    Code:
    	<bean id="messageSource"
    		class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    		<property name="basename" value="classpath:tscart-messages" />
    		<property name="fallbackToSystemLocale" value="false" />
    	</bean>

  6. #6

    Default bean "messageSource" loaded in wrong context

    Hi, for me the problem was solved when I moved the "messageSource" definition from the servlet context, e.g. "shippingrate-servlet.xml" to my root context "applicationContext.xml" The reason was that the code was trying to reach the message source in the root context.



    /Peter

  7. #7
    Join Date
    Jan 2007
    Posts
    1

    Default

    Perhaps a rather late reaction, but it could be useful to others:
    I had the same problem, and it was due to a classpath problem. There was another messages.properties file on my classpath, which was found before the one in my WEB-INF folder.
    So, cleaning your project, or renaming the file to myapp-messages.properties could do the trick.

  8. #8
    Join Date
    Sep 2005
    Posts
    4

    Default

    Hi,

    I had the same problem too. In my case the problem was the use of ReloadableResourceBundleMessageSource in the *-servlet.xml. The problem disappeared when I replace it for ResourceBundleMessageSource.

  9. #9
    Join Date
    Feb 2008
    Posts
    13

    Default

    Hi, I have a similiar problem, I'd appreciate some help with this...
    I have a messages.properties configured in my applicationContext.xml and it was working fine. Now I get a "No message found under code myCode for locale es_ES" but just with ONE of the messages. All other error message is displayed with no problem.
    I'm using SpringMVC.

  10. #10
    Join Date
    Aug 2008
    Location
    Jersey
    Posts
    3

    Thumbs up <spring:message> tag not finding properties file code

    Yes, for me it was what Peter Odéus did to solve the problem. I had a login.jsp file that was just outside the WEB-INF directory, so the <spring:message> codes were not being found. I switched the bean call as Junior Member Peter Odéus did to the applicatonContext.xml root spring configuration file and viola, the <spring:message> tag found the code and now I can complete internationalization (i18n) for my project by localizing the login.jsp page.
    Thanks Peter.........

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. UpgradeAcegi Security System from 0.6.1 to 0.8.3
    By mannobug in forum Security
    Replies: 3
    Last Post: Sep 23rd, 2005, 07:00 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Replies: 4
    Last Post: Aug 17th, 2005, 04:42 AM
  5. Replies: 2
    Last Post: May 13th, 2005, 05:42 AM

Posting Permissions

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