Home  >  Forum  >  Spring
Post New Query

Cannot change HTTP accept header - use a different locale resolution strategy


joined on
November 02,2014
Asked on May 02,2015
Hi, I am facing an error while creating my Spring MVC internationalization application. Any Clue?


java.lang.UnsupportedOperationException: Cannot change HTTP accept header - use a different locale resolution strategy
org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver.setLocale(AcceptHeaderLocaleResolver.java:46)
org.springframework.web.servlet.i18n.LocaleChangeInterceptor.preHandle(LocaleChangeInterceptor.java:73)
org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:134)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
joined on
March 22,2015
Replied on May 02,2015

Probably you do not have any bean  defined as "localeResolver" because by default AcceptHeaderLocaleResolver is implemented by spring which does not allow locale changed by setLocale() method. So you need to check if you have defined a bean for "localeResolver". You can do it like

@Bean
public LocaleResolver localeResolver(){}

Or

@Bean(name="localeResolver")
public LocaleResolver setupLocaleResolver(){}



joined on
November 02,2014
Replied on May 02,2015

Write solution. Thnaks

Write Answer








Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us