gelbander
Jan 15th, 2010, 03:34 AM
Im quite new to spring, and forums as well. So tell me what I do wrong.
Im just gonna validate a User object, according to the reference its quite simple but I get a strange error.
2010-01-15 09:59:22 ERROR org.springframework.web.servlet.tags.RequestContex tAwareTag:85 - No message found under code 'username.user.username' for locale 'sv_SE'.
org.springframework.context.NoSuchMessageException : No message found under code 'username.user.username' for locale 'sv_SE'.
at org.springframework.context.support.DelegatingMess ageSource.getMessage(DelegatingMessageSource.java: 79)
at org.springframework.context.support.DelegatingMess ageSource.getMessage(DelegatingMessageSource.java: 71)
at org.springframework.context.support.AbstractApplic ationContext.getMessage(AbstractApplicationContext .java:1125)
at org.springframework.web.servlet.support.RequestCon text.getMessage(RequestContext.java:559)
at org.springframework.web.servlet.support.BindStatus .initErrorMessages(BindStatus.java:177)
at org.springframework.web.servlet.support.BindStatus .getErrorMessages(BindStatus.java:273)
at org.springframework.web.servlet.tags.form.ErrorsTa g.exposeAttributes(ErrorsTag.java:172)
at org.springframework.web.servlet.tags.form.Abstract HtmlElementBodyTag.writeTagContent(AbstractHtmlEle mentBodyTag.java:48)
at org.springframework.web.servlet.tags.form.Abstract FormTag.doStartTagInternal(AbstractFormTag.java:91 )
at org.springframework.web.servlet.tags.RequestContex tAwareTag.doStartTag(RequestContextAwareTag.java:7 8)
at _jsp._WEB_22dINF._jsp._user._edit__jsp._jspService (_edit__jsp.java:105)
at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
at com.caucho.jsp.Page.pageservice(Page.java:587)
at com.caucho.server.dispatch.PageFilterChain.doFilte r(PageFilterChain.java:195)
at com.caucho.server.webapp.DispatchFilterChain.doFil ter(DispatchFilterChain.java:97)
at com.caucho.server.dispatch.ServletInvocation.servi ce(ServletInvocation.java:265)
at com.caucho.server.webapp.RequestDispatcherImpl.for ward(RequestDispatcherImpl.java:293)
at com.caucho.server.webapp.RequestDispatcherImpl.for ward(RequestDispatcherImpl.java:111)
at org.springframework.web.servlet.view.InternalResou rceView.renderMergedOutputModel(InternalResourceVi ew.java:239)
at org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:250)
at org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1060)
at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:798)
at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:563)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:153)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:91)
at com.caucho.server.dispatch.ServletFilterChain.doFi lter(ServletFilterChain.java:103)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.ob tainContent(SiteMeshFilter.java:129)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.do Filter(SiteMeshFilter.java:77)
at com.caucho.server.dispatch.FilterFilterChain.doFil ter(FilterFilterChain.java:87)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 344)
at org.springframework.security.web.access.intercept. FilterSecurityInterceptor.invoke(FilterSecurityInt erceptor.java:110)
at org.springframework.security.web.access.intercept. FilterSecurityInterceptor.doFilter(FilterSecurityI nterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.access.ExceptionT ranslationFilter.doFilter(ExceptionTranslationFilt er.java:98)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.session.SessionMa nagementFilter.doFilter(SessionManagementFilter.ja va:95)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.An onymousAuthenticationFilter.doFilter(AnonymousAuth enticationFilter.java:79)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.re memberme.RememberMeAuthenticationFilter.doFilter(R ememberMeAuthenticationFilter.java:120)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.servletapi.Securi tyContextHolderAwareRequestFilter.doFilter(Securit yContextHolderAwareRequestFilter.java:55)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.savedrequest.Requ estCacheAwareFilter.doFilter(RequestCacheAwareFilt er.java:36)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.ww w.BasicAuthenticationFilter.doFilter(BasicAuthenti cationFilter.java:178)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.Ab stractAuthenticationProcessingFilter.doFilter(Abst ractAuthenticationProcessingFilter.java:188)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.lo gout.LogoutFilter.doFilter(LogoutFilter.java:106)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.context.SecurityC ontextPersistenceFilter.doFilter(SecurityContextPe rsistenceFilter.java:80)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.FilterChainProxy. doFilter(FilterChainProxy.java:150)
at org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterPro xy.doFilter(DelegatingFilterProxy.java:167)
at com.caucho.server.dispatch.FilterFilterChain.doFil ter(FilterFilterChain.java:87)
at com.caucho.server.webapp.WebAppFilterChain.doFilte r(WebAppFilterChain.java:187)
at com.caucho.server.dispatch.ServletInvocation.servi ce(ServletInvocation.java:265)
at com.caucho.server.http.HttpRequest.handleRequest(H ttpRequest.java:273)
at com.caucho.server.port.TcpConnection.run(TcpConnec tion.java:682)
at com.caucho.util.ThreadPool$Item.runTasks(ThreadPoo l.java:743)
at com.caucho.util.ThreadPool$Item.run(ThreadPool.jav a:662)
at java.lang.Thread.run(Thread.java:619)
[09:59:22.267] {http--8080-1$3071654} org.springframework.web.util.NestedServletExceptio n: Request processing failed; nested exception is org.springframework.context.NoSuchMessageException : No message found under code 'username.user.username' for locale 'sv_SE'.
[09:59:22.267] {http--8080-1$3071654} at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:659)
[09:59:22.267] {http--8080-1$3071654} at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:563)
[09:59:22.267] {http--8080-1$3071654} at javax.servlet.http.HttpServlet.service(HttpServlet .java:153)
[09:59:22.267] {http--8080-1$3071654} at javax.servlet.http.HttpServlet.service(HttpServlet .java:91)
[09:59:22.267] {http--8080-1$3071654} at com.caucho.server.dispatch.ServletFilterChain.doFi lter(ServletFilterChain.java:103)
[09:59:22.267] {http--8080-1$3071654} at com.opensymphony.sitemesh.webapp.SiteMeshFilter.ob tainContent(SiteMeshFilter.java:129)
[09:59:22.267] {http--8080-1$3071654} at com.opensymphony.sitemesh.webapp.SiteMeshFilter.do Filter(SiteMeshFilter.java:77)
[09:59:22.267] {http--8080-1$3071654} at com.caucho.server.dispatch.FilterFilterChain.doFil ter(FilterFilterChain.java:87)
This is the only thing I want to do.
@Component
public class UserValidator implements Validator {
public boolean supports(Class clazz) {
return User.class.equals(clazz);
}
public void validate(Object obj, Errors e) {
ValidationUtils.rejectIfEmpty(e, "username", "username.requierd");
}
}
It seemt that there is some problem getting the error message to the jsp because if I redirect to some other page everything works "fine".
Anyone encountered this problem before?
I use Spring 3 and resin server.
Im just gonna validate a User object, according to the reference its quite simple but I get a strange error.
2010-01-15 09:59:22 ERROR org.springframework.web.servlet.tags.RequestContex tAwareTag:85 - No message found under code 'username.user.username' for locale 'sv_SE'.
org.springframework.context.NoSuchMessageException : No message found under code 'username.user.username' for locale 'sv_SE'.
at org.springframework.context.support.DelegatingMess ageSource.getMessage(DelegatingMessageSource.java: 79)
at org.springframework.context.support.DelegatingMess ageSource.getMessage(DelegatingMessageSource.java: 71)
at org.springframework.context.support.AbstractApplic ationContext.getMessage(AbstractApplicationContext .java:1125)
at org.springframework.web.servlet.support.RequestCon text.getMessage(RequestContext.java:559)
at org.springframework.web.servlet.support.BindStatus .initErrorMessages(BindStatus.java:177)
at org.springframework.web.servlet.support.BindStatus .getErrorMessages(BindStatus.java:273)
at org.springframework.web.servlet.tags.form.ErrorsTa g.exposeAttributes(ErrorsTag.java:172)
at org.springframework.web.servlet.tags.form.Abstract HtmlElementBodyTag.writeTagContent(AbstractHtmlEle mentBodyTag.java:48)
at org.springframework.web.servlet.tags.form.Abstract FormTag.doStartTagInternal(AbstractFormTag.java:91 )
at org.springframework.web.servlet.tags.RequestContex tAwareTag.doStartTag(RequestContextAwareTag.java:7 8)
at _jsp._WEB_22dINF._jsp._user._edit__jsp._jspService (_edit__jsp.java:105)
at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
at com.caucho.jsp.Page.pageservice(Page.java:587)
at com.caucho.server.dispatch.PageFilterChain.doFilte r(PageFilterChain.java:195)
at com.caucho.server.webapp.DispatchFilterChain.doFil ter(DispatchFilterChain.java:97)
at com.caucho.server.dispatch.ServletInvocation.servi ce(ServletInvocation.java:265)
at com.caucho.server.webapp.RequestDispatcherImpl.for ward(RequestDispatcherImpl.java:293)
at com.caucho.server.webapp.RequestDispatcherImpl.for ward(RequestDispatcherImpl.java:111)
at org.springframework.web.servlet.view.InternalResou rceView.renderMergedOutputModel(InternalResourceVi ew.java:239)
at org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:250)
at org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1060)
at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:798)
at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:563)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:153)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:91)
at com.caucho.server.dispatch.ServletFilterChain.doFi lter(ServletFilterChain.java:103)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.ob tainContent(SiteMeshFilter.java:129)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.do Filter(SiteMeshFilter.java:77)
at com.caucho.server.dispatch.FilterFilterChain.doFil ter(FilterFilterChain.java:87)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 344)
at org.springframework.security.web.access.intercept. FilterSecurityInterceptor.invoke(FilterSecurityInt erceptor.java:110)
at org.springframework.security.web.access.intercept. FilterSecurityInterceptor.doFilter(FilterSecurityI nterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.access.ExceptionT ranslationFilter.doFilter(ExceptionTranslationFilt er.java:98)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.session.SessionMa nagementFilter.doFilter(SessionManagementFilter.ja va:95)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.An onymousAuthenticationFilter.doFilter(AnonymousAuth enticationFilter.java:79)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.re memberme.RememberMeAuthenticationFilter.doFilter(R ememberMeAuthenticationFilter.java:120)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.servletapi.Securi tyContextHolderAwareRequestFilter.doFilter(Securit yContextHolderAwareRequestFilter.java:55)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.savedrequest.Requ estCacheAwareFilter.doFilter(RequestCacheAwareFilt er.java:36)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.ww w.BasicAuthenticationFilter.doFilter(BasicAuthenti cationFilter.java:178)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.Ab stractAuthenticationProcessingFilter.doFilter(Abst ractAuthenticationProcessingFilter.java:188)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.authentication.lo gout.LogoutFilter.doFilter(LogoutFilter.java:106)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.context.SecurityC ontextPersistenceFilter.doFilter(SecurityContextPe rsistenceFilter.java:80)
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 356)
at org.springframework.security.web.FilterChainProxy. doFilter(FilterChainProxy.java:150)
at org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterPro xy.doFilter(DelegatingFilterProxy.java:167)
at com.caucho.server.dispatch.FilterFilterChain.doFil ter(FilterFilterChain.java:87)
at com.caucho.server.webapp.WebAppFilterChain.doFilte r(WebAppFilterChain.java:187)
at com.caucho.server.dispatch.ServletInvocation.servi ce(ServletInvocation.java:265)
at com.caucho.server.http.HttpRequest.handleRequest(H ttpRequest.java:273)
at com.caucho.server.port.TcpConnection.run(TcpConnec tion.java:682)
at com.caucho.util.ThreadPool$Item.runTasks(ThreadPoo l.java:743)
at com.caucho.util.ThreadPool$Item.run(ThreadPool.jav a:662)
at java.lang.Thread.run(Thread.java:619)
[09:59:22.267] {http--8080-1$3071654} org.springframework.web.util.NestedServletExceptio n: Request processing failed; nested exception is org.springframework.context.NoSuchMessageException : No message found under code 'username.user.username' for locale 'sv_SE'.
[09:59:22.267] {http--8080-1$3071654} at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:659)
[09:59:22.267] {http--8080-1$3071654} at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:563)
[09:59:22.267] {http--8080-1$3071654} at javax.servlet.http.HttpServlet.service(HttpServlet .java:153)
[09:59:22.267] {http--8080-1$3071654} at javax.servlet.http.HttpServlet.service(HttpServlet .java:91)
[09:59:22.267] {http--8080-1$3071654} at com.caucho.server.dispatch.ServletFilterChain.doFi lter(ServletFilterChain.java:103)
[09:59:22.267] {http--8080-1$3071654} at com.opensymphony.sitemesh.webapp.SiteMeshFilter.ob tainContent(SiteMeshFilter.java:129)
[09:59:22.267] {http--8080-1$3071654} at com.opensymphony.sitemesh.webapp.SiteMeshFilter.do Filter(SiteMeshFilter.java:77)
[09:59:22.267] {http--8080-1$3071654} at com.caucho.server.dispatch.FilterFilterChain.doFil ter(FilterFilterChain.java:87)
This is the only thing I want to do.
@Component
public class UserValidator implements Validator {
public boolean supports(Class clazz) {
return User.class.equals(clazz);
}
public void validate(Object obj, Errors e) {
ValidationUtils.rejectIfEmpty(e, "username", "username.requierd");
}
}
It seemt that there is some problem getting the error message to the jsp because if I redirect to some other page everything works "fine".
Anyone encountered this problem before?
I use Spring 3 and resin server.