Announcement Announcement Module
Collapse
No announcement yet.
@RequestParam failing to work (sometimes) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @RequestParam failing to work (sometimes)

    Hi all,

    Code:
    @RequestMapping(method = RequestMethod.GET)
    	public String setupForm(@RequestParam(required=false, value="id") Long id, ModelMap model) {
    		TicketDefinition ticketDef = formBackingObject(id);
    		model.addAttribute("ticketDef", ticketDef);
    		return "/admin/ticketDefinitionEdit";
    	}
    (Spring 3.0)

    The code above was fine when I was developing locally on my windows machine running resin 3.1.8 server. However after deploying the project as a war file on a unix/linux machine running resin 3.1.9 the same code causes the following exception and stack trace:

    Code:
    org.springframework.web.util.NestedServletException: Request processing
    failed; nested exception is org.springframework.web.bind.annotation.support.HandlerMethodInvocationException:
    Failed to invoke handler method [public java.lang.String ss.web.ref.TicketDefinitionEditController.setupForm(java.lang.Long,org.springframework.ui.ModelMap)];
    nested exception is java.lang.IllegalStateException: No parameter name
    specified for argument of type [java.lang.Long], and no parameter name
    information found in class file either.
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:659)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:114)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
    	at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
    	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    	at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    .....
    	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:265)
    	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:273)
    	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:682)
    	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743)
    	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:662)
    	at java.lang.Thread.run(Thread.java:619)
    Caused by: org.springframework.web.bind.annotation.support.HandlerMethodInvocationException:
    Failed to invoke handler method [public java.lang.String ss.web.ref.TicketDefinitionEditController.setupForm(java.lang.Long,org.springframework.ui.ModelMap)];
    nested exception is java.lang.IllegalStateException: No parameter name
    specified for argument of type [java.lang.Long], and no parameter name
    information found in class file either.
    	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171)
    	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
    	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:114)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
    	at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
    	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    	at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
    	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
    	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:265)
    	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:273)
    	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:682)
    	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743)
    	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:662)
    	at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.IllegalStateException: No parameter name specified
    for argument of type [java.lang.Long], and no parameter name information
    found in class file either.
    I have googled and googled and the closest similar issue I can find is to do with the same exception being caused if you do not specify value="xxx" in the @RequestParam annotation. However, as you can see, I have specified this information and still get the same problem. I have not been able to find any help online...

    Also, this problem affects just a few other similar controllers but none of the other controllers in the project which also use @RequestParam.

    Any ideas??

    Thanks

  • #2
    It seems when java files are compiled on my windows machine there is no problem but when thw java files are compiled on the unix/linux machine I get the problem I have described. Both machines are running the same version of java (1.6.0_18) and compiling to 1.6 compliance. The windows machine is 32-bit whereas the unix/linux machine is 64-bit.

    If I copy the .class file compiled on the windows machine to the unix/linux machine it works. If I copy the .class file compiled on the unix/linux machine to the windows machine it does not work.

    What I don't get is that this problem is only affecting a small subset of my spring controllers (all within the same package). Controllers in other packages that have been set up the same way have no problems...

    Any ideas

    Thanks

    Comment


    • #3
      Hopefully you already figured this out, but I was having the same problem. Your build scripts are probably not using debug mode to retain variable names. See these links for more info.

      http://stackoverflow.com/questions/2...ue-in-spring-3

      http://www.objectpartners.com/2010/0...-head-slapper/

      Comment

      Working...
      X