Spring MVC Report Exception: Org.springframework.web.util.NestedServletException:Request processing failed

Source: Internet
Author: User

When using the SPRINGMVC binding base type (such as String,integer, etc.) parameters, specify the specific parameter name through the @requestparam annotation, otherwise, when the source code is compiled in non-debug mode, The runtime throws a Handlermethodinvocationexception exception because the parameter name is stored in the compiled code only if it is compiled in debug mode.

For example, the following code throws an exception:

@RequestMapping (value = "/security/login", method = requestmethod.post) public modelandview login (@RequestParam String UserName, @RequestParam String password,     httpservletrequest request) {.............    




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.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.servlet.FrameworkServlet.processRequest (frameworkservlet.java:659)
..........

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)
..........


Java.lang.IllegalStateException:No parameter name specified for argument of type [java.lang.String], and No parameter Nam E information found in class file either.
Org.springframework.web.bind.annotation.support.HandlerMethodInvoker.getRequiredParameterName ( handlermethodinvoker.java:618)
..........



Java code

@RequestMapping (value = "/security/login", method = Requestmethod.post)

Public Modelandview Login (@RequestParam ("UserName") String UserName, @RequestParam ("password") String password, httpservletrequest request) {

......................

Spring MVC Report Exception: Org.springframework.web.util.NestedServletException:Request processing failed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.