Deal of the Day

Home » Main » Manning Forums » 2008 » Spring in Practice

Thread: Unsupported argument [org.springframework.web.bind.ServletRequestDataBinder

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 3 - Pages: 1 - Last Post: Dec 7, 2009 1:50 PM by: vicina.info
vicina.info


Posts: 24
Registered: 4/13/09
Unsupported argument [org.springframework.web.bind.ServletRequestDataBinder
Posted: Nov 28, 2009 2:40 PM
  Click to reply to this thread Reply

I use the code on the page 288

@InitBinder
protected void initBinder(ServletRequestDataBinder binder) {
binder.registerCustomEditor(byte[].class,
new ByteArrayMultipartFileEditor());
}

and get the following exception with the org.springframework.web.bind.ServletRequestDataBinder

java.lang.IllegalStateException: Unsupported argument [org.springframework.web.bind.ServletRequestDataBinder] for @InitBinder method: protected void com.abc.myapp.web.owner.UploadItemImageController.initBinder(org.springframework.web.bind.ServletRequestDataBinder)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveInitBinderArguments(HandlerMethodInvoker.java:385)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.initBinder(HandlerMethodInvoker.java:322)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolvePathVariable(HandlerMethodInvoker.java:607)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:287)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:161)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:378)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:366)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:71)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:344)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:110)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:98)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:95)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:110)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:55)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:36)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:150)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

What is missing?

vicina.info


Posts: 24
Registered: 4/13/09
Re: Unsupported argument [org.springframework.web.bind.ServletRequestDataBinder
Posted: Nov 28, 2009 4:33 PM   in response to: vicina.info in response to: vicina.info
  Click to reply to this thread Reply

It shall use org.springframework.web.bind.WebDataBinder as the argument instead. So, that code is not working for Spring 3.0.

bbaron

Posts: 63
From: earth
Registered: 9/28/08
Re: Unsupported argument [org.springframework.web.bind.ServletRequestDataBinder
Posted: Dec 7, 2009 8:40 AM   in response to: vicina.info in response to: vicina.info
  Click to reply to this thread Reply

I suspect much of the delay on this MEAP is the fact the authors started writing it for Spring 2.5 and are now trying to upgrade to 3.0. It wouldn't make sense to publish this book now or next year, if it didn't cover 3.0.

vicina.info


Posts: 24
Registered: 4/13/09
Re: Unsupported argument [org.springframework.web.bind.ServletRequestDataBinder
Posted: Dec 7, 2009 1:50 PM   in response to: bbaron in response to: bbaron
  Click to reply to this thread Reply

If my memory serves me correctly, the authors had set their goal for this book to cover Spring 3.0 which was stated somewhere in the book. The Spring core used to have a very good backward compatibility. This case is totally out of my experience with Spring. The Spring non-core projects such as Spring Security is the other story. The new Spring Security 3.0 is not compatible with the 2.0 based on my experience/headache.

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor