报错:“Request processing failed;nested exception is java.lang.NullPointerException”

今天在整个ssm的时候出现了个低级错误,开始一直没找出来,运行错误如下。
一直报空指针异常,检查SQL语句,控制类一直没看出来错误。
ssm项目写上传文件的时候报错空指针异常解决方案

严重: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException
at com.yq.controller.WorkController.insert(WorkController.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)

最后想了一下发现在写的前台页面的时候,文件上传忘记写 enctype=“multipart/form-data”,
所以才出现错误。
ssm项目写上传文件的时候报错空指针异常解决方案
添加后就好了。

相关文章:

  • 1970-01-01
  • 2021-07-13
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2021-06-21
猜你喜欢
  • 2022-12-23
  • 2021-08-07
  • 2021-10-20
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2021-12-29
相关资源
相似解决方案