java.lang.NullPointerException] with root cause

  • Post author:
  • Post category:java




SSM前后端提交数据时报此错问题



相关出错代码如下

一月 26, 2020 11:46:45 下午 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet [springServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

java.lang.NullPointerException

at com.zcw.my.shop.web.admin.web.controller.UserController.delete(UserController.java:99)

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:205)

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

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

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)

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

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

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)

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

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

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

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1136)

at org.apache.coyote.AbstractProtocol



A

b

s

t

r

a

c

t

C

o

n

n

e

c

t

i

o

n

H

a

n

d

l

e

r

.

p

r

o

c

e

s

s

(

A

b

s

t

r

a

c

t

P

r

o

t

o

c

o

l

.

j

a

v

a

:

637

)

a

t

o

r

g

.

a

p

a

c

h

e

.

t

o

m

c

a

t

.

u

t

i

l

.

n

e

t

.

J

I

o

E

n

d

p

o

i

n

t

AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint






A


b


s


t


r


a


c


t


C


o


n


n


e


c


t


i


o


n


H


a


n


d


l


e


r


.


p


r


o


c


e


s


s


(


A


b


s


t


r


a


c


t


P


r


o


t


o


c


o


l


.


j


a


v


a




:








6


3


7


)


a


t


o


r


g


.


a


p


a


c


h


e


.


t


o


m


c


a


t


.


u


t


i


l


.


n


e


t


.


J


I


o


E


n


d


p


o


i


n


t





SocketProcessor.run(JIoEndpoint.java:316)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor



W

o

r

k

e

r

.

r

u

n

(

T

h

r

e

a

d

P

o

o

l

E

x

e

c

u

t

o

r

.

j

a

v

a

:

617

)

a

t

o

r

g

.

a

p

a

c

h

e

.

t

o

m

c

a

t

.

u

t

i

l

.

t

h

r

e

a

d

s

.

T

a

s

k

T

h

r

e

a

d

Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread






W


o


r


k


e


r


.


r


u


n


(


T


h


r


e


a


d


P


o


o


l


E


x


e


c


u


t


o


r


.


j


a


v


a




:








6


1


7


)


a


t


o


r


g


.


a


p


a


c


h


e


.


t


o


m


c


a


t


.


u


t


i


l


.


t


h


r


e


a


d


s


.


T


a


s


k


T


h


r


e


a


d





WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)



出现以上问题一般都是前端穿过来的参数(对象)调用了方法,而传过来的对象却为NULL,所以解决方法就是检查传过来的参数是否为空,再次确认前端与后端数据的交互



版权声明:本文为weixin_43881282原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。