严重 [http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for

时间:2024-04-09 09:01:39

严重 [http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [tech.aistar.prj.controller.PetUpdateViewAction] in context with path [/servlet] threw exception

idea端Log报错:

严重 [http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for

右侧严重 [http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for

客户端报错:

严重 [http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for

idea中HttpServlet继承类PetUpdateViewAction问题所在行:

严重 [http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for

红色框为报错行,错误原因:此处pets未取到数据,为null,而null.size() 就是错误的原因;

蓝色框中pets取不到数据的原因是:跳转到当前类没有使用转发,而是通过超链接,没有带来转发出发页面的req.getRequestDispatcher(urlPatterns).forward(req,resp);

 

解决办法:

在当前类中,重新从数据库中调取数据,不使用req.getAttribute(“”);如下图:

严重 [http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for

修改之后客户端运行界面:

严重 [http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for