org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.context.NoSuchMessageException: No message found under code 'custom.link' for locale 'en'.

Spring JIRA | Petar Tahchiev | 2 years ago
  1. 0

    Spring Boot + MockMvc + MessageSource

    GitHub | 2 years ago | paranoiabla
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.context.NoSuchMessageException: No message found under code 'custom.link' for locale 'en'.
  2. 0

    Hello, following this question here: http://stackoverflow.com/questions/28569445/spring-boot-mockmvc-and-messagesource I have created a sample application that demonstrates the problem. https://github.com/paranoiabla/spring-boot-mockmvc If you try to use {{MessageSource}} in one of your {{Controller}} classes in a spring-boot application you get this exception: {code} org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.context.NoSuchMessageException: No message found under code 'custom.link' for locale 'en'. at org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:159) at net.test.MyController.home(MyController.java:29) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) at javax.servlet.http.HttpServlet.service(HttpServlet.java:618) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at org.springframework.test.web.servlet.TestDispatcherServlet.service(TestDispatcherServlet.java:65) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.springframework.mock.web.MockFilterChain$ServletFilterProxy.doFilter(MockFilterChain.java:167) at org.springframework.mock.web.MockFilterChain.doFilter(MockFilterChain.java:134) at org.springframework.test.web.servlet.MockMvc.perform(MockMvc.java:144) at net.test.MyControllerIntegrationTest.testGetAccount(MyControllerIntegrationTest.java:23) {code}

    Spring JIRA | 2 years ago | Petar Tahchiev
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.context.NoSuchMessageException: No message found under code 'custom.link' for locale 'en'.
  3. 0

    Hello, following this question here: http://stackoverflow.com/questions/28569445/spring-boot-mockmvc-and-messagesource I have created a sample application that demonstrates the problem. https://github.com/paranoiabla/spring-boot-mockmvc If you try to use {{MessageSource}} in one of your {{Controller}} classes in a spring-boot application you get this exception: {code} org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.context.NoSuchMessageException: No message found under code 'custom.link' for locale 'en'. at org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:159) at net.test.MyController.home(MyController.java:29) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) at javax.servlet.http.HttpServlet.service(HttpServlet.java:618) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at org.springframework.test.web.servlet.TestDispatcherServlet.service(TestDispatcherServlet.java:65) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.springframework.mock.web.MockFilterChain$ServletFilterProxy.doFilter(MockFilterChain.java:167) at org.springframework.mock.web.MockFilterChain.doFilter(MockFilterChain.java:134) at org.springframework.test.web.servlet.MockMvc.perform(MockMvc.java:144) at net.test.MyControllerIntegrationTest.testGetAccount(MyControllerIntegrationTest.java:23) {code}

    Spring JIRA | 2 years ago | Petar Tahchiev
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.context.NoSuchMessageException: No message found under code 'custom.link' for locale 'en'.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring Boot, MockMVC and MessageSource

    Stack Overflow | 2 years ago | Petar Tahchiev
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.context.NoSuchMessageException: No message found under code 'custom.link' for locale 'en'.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.web.util.NestedServletException

      Request processing failed; nested exception is org.springframework.context.NoSuchMessageException: No message found under code 'custom.link' for locale 'en'.

      at org.springframework.context.support.AbstractMessageSource.getMessage()
    2. Spring Context
      AbstractMessageSource.getMessage
      1. org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:159)
      1 frame
    3. net.test
      MyController.home
      1. net.test.MyController.home(MyController.java:29)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:606)
      4 frames
    5. Spring
      InvocableHandlerMethod.invokeForRequest
      1. org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
      2. org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
      2 frames
    6. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
      2. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
      3. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
      4. org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
      5. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
      6. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
      7. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
      8. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
      8 frames
    7. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
      1 frame
    8. Spring MVC
      FrameworkServlet.service
      1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
      1 frame
    9. Spring TestContext
      TestDispatcherServlet.service
      1. org.springframework.test.web.servlet.TestDispatcherServlet.service(TestDispatcherServlet.java:65)
      1 frame
    10. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
      1 frame
    11. Spring TestContext
      MockMvc.perform
      1. org.springframework.mock.web.MockFilterChain$ServletFilterProxy.doFilter(MockFilterChain.java:167)
      2. org.springframework.mock.web.MockFilterChain.doFilter(MockFilterChain.java:134)
      3. org.springframework.test.web.servlet.MockMvc.perform(MockMvc.java:144)
      3 frames
    12. net.test
      MyControllerIntegrationTest.testGetAccount
      1. net.test.MyControllerIntegrationTest.testGetAccount(MyControllerIntegrationTest.java:23)
      1 frame