springmvc中报错Request processing failed;

简介: springmvc中报错Request processing failed;

今天在整个ssm的时候出现了个低级错误,找了好久才找出来,在发现真理的那一刻,我都有死的冲动了。

报错如下:

HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalStateException: Optional int parameter ‘eid’ is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.

type Exception report

message Request processing failed; nested exception is java.lang.IllegalStateException: Optional int parameter ‘eid’ is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.

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

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Optional int parameter ‘eid’ is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)

org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)

javax.servlet.http.HttpServlet.service(HttpServlet.java:624)

org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)

root cause

java.lang.IllegalStateException: Optional int parameter ‘eid’ is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.

org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleNullValue(AbstractNamedValueMethodArgumentResolver.java:188)

org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:94)

org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77)

org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:157)

org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:124)

org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:685)

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)

org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)

javax.servlet.http.HttpServlet.service(HttpServlet.java:624)

org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.70 logs.

截图如下所示:

解决方法:

删除

这一行代码中的eid后面有个空格,删除掉了就可以了!!

相关文章
SpringMVC入门到实战------5、域对象共享数据 Request、Session、Application、Model、ModelAndView、Map、ModelMap的详细使用及代码实例
这篇文章详细解释了在IntelliJ IDEA中如何使用Mute Breakpoints功能来快速跳过程序中的后续断点,并展示了如何一键清空所有设置的断点。
SpringMVC入门到实战------5、域对象共享数据 Request、Session、Application、Model、ModelAndView、Map、ModelMap的详细使用及代码实例
|
7月前
|
前端开发 Java Spring
Spring MVC 出现Request method ‘GET‘ not supported解决办法
Spring MVC 出现Request method ‘GET‘ not supported解决办法
|
Java Spring
springMVC中获取request 对象
springMVC中获取request 对象
|
XML Java 应用服务中间件
Springmvc中报data错误页面显示400报错_解决
Springmvc中报data错误页面显示400报错_解决
|
前端开发 Java Spring
Spring MVC框架:第四章:属性域使用(request域、session域、application域)
Spring MVC框架:第四章:属性域使用(request域、session域、application域)
126 0
Spring MVC框架:第四章:属性域使用(request域、session域、application域)
|
Java Spring
springmvc:405 request method post not supported
springmvc:405 request method post not supported
184 0
|
前端开发
SpringMVC - Failed to instantiate Specified class is an interface
SpringMVC - Failed to instantiate Specified class is an interface
552 0
|
Java
SpringMVC之自动注入Request对象
前几天看了领导写的一段代码,在Controller中注入了HttpServletRequest,形式如下所示: @RestController public class AutowiredRequestController { @Aut...
1535 0