Compile class issue in Spring 3

I used spring framework 3 for my application. Everything is fine, while in Netbeans But I need a special assembly and is made for it. Created without any, but I got the following error. An error occurred while calling the following method.

@RequestMapping(value = "/security/login", method = RequestMethod.POST) public ModelAndView login(@RequestParam String userName, @RequestParam String password, HttpServletRequest request) { ...................... 

But there is no problem when creating a war with netbeans (I am sure that this is a compilation problem) Do you have experience in this matter ... Is there any additional javac argument for compiling the same (netbeans is used to compile)

Type of exception report

message

  description The server encountered an internal error () that prevented it from fulfilling this request. 

exceptions

  org.springframework.web.util.NestedServletException: Request processing failed;  nested exception is org.springframework.web.bind.annotation.support.HandlerMethodInvocationException: Failed to invoke handler method [public org.springframework.web.servlet.ModelAndView com.mypackage.security.controller.LoginController.login (java.langString , java.lang.String, javax.servlet.http.HttpServletRequest)];  nested exception is java.lang.IllegalStateException: No parameter name specified for argument of type [java.lang.String], and no parameter name information found in class file either.
  org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java:659)
  org.springframework.web.servlet.FrameworkServlet.doPost (FrameworkServlet.java∗63)
  javax.servlet.http.HttpServlet.service (HttpServlet.java:637)
  javax.servlet.http.HttpServlet.service (HttpServlet.java:717)
  com.mypackage.security.controller.AuthFilter.doFilter (Unknown Source)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy.java:237)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy.java:167) 

The main reason

  org.springframework.web.bind.annotation.support.HandlerMethodInvocationException: Failed to invoke handler method [public org.springframework.web.servlet.ModelAndView com.mypackage.security.controller.LoginController.login (java.lang.String, java. lang.String, javax.servlet.http.HttpServletRequest)];  nested exception is java.lang.IllegalStateException: No parameter name specified for argument of type [java.lang.String], and no parameter name information found in class file either.
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod (HandlerMethodInvoker.java:171)
  org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod (AnnotationMethodHandlerAdapter.java:414)
  org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle (AnnotationMethodHandlerAdapter.java:402)
  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.doPost (FrameworkServlet.java∗63)
  javax.servlet.http.HttpServlet.service (HttpServlet.java:637)
  javax.servlet.http.HttpServlet.service (HttpServlet.java:717)
  com.mypackage.security.controller.AuthFilter.doFilter (Unknown Source)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy.java:237)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy.java:167) 

The main reason

  java.lang.IllegalStateException: No parameter name specified for argument of type [java.lang.String], and no parameter name information found in class file either.
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.getRequiredParameterName (HandlerMethodInvoker.java:618)
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestParam (HandlerMethodInvoker.java:417)
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments (HandlerMethodInvoker.java:277)
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod (HandlerMethodInvoker.java:163)
  org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod (AnnotationMethodHandlerAdapter.java:414)
  org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle (AnnotationMethodHandlerAdapter.java:402)
  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.doPost (FrameworkServlet.java∗63)
  javax.servlet.http.HttpServlet.service (HttpServlet.java:637)
  javax.servlet.http.HttpServlet.service (HttpServlet.java:717)
  com.mypackage.security.controller.AuthFilter.doFilter (Unknown Source)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy.java:237)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy.java:167)

note A complete trace of the root cause stack is available in the Apache Tomcat / 6.0.18 logs.

+6
spring javac ant
source share
1 answer

Argument names are stored in compiled code only when it is compiled in debug mode, so you must either compile it in debug mode or put @RequestParam with explicit parameter names. The latter approach is more reliable since it is environment independent:

 @RequestMapping(value = "/security/login", method = RequestMethod.POST) public ModelAndView login(@RequestParam("userName") String userName, @RequestParam("password") String password, HttpServletRequest request) { ...................... 
+18
source share

All Articles