赞
踩
2023-08-13 15:34:43.370 ERROR 9900 --- [nio-9090-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : 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: null
at com.hdl.mall.product.service.impl.CategoryServiceImpl.lambda$listWithTree$0(CategoryServiceImpl.java:38) ~[classes/:na]
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) ~[na:1.8.0_181]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) ~[na:1.8.0_181]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[na:1.8.0_181]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_181]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_181]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_181]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_181]
1.然后我仔细检查代码发现并没有错误,于是根据提示debug错误位置,发现下列异常
2. 根据这个异常发现可能是数据库表中的数据存在Null的情况,返回的数据后,再进行取值就可能显示空指针异常;
3.最后查看数据库数据,还真发现了Null值,并在代码中进行取值操作
4.最后把null值处理下就正常运行了
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。