undefinedfix
Sign in

About the null pointerexception null pointer exception in servlet forward, which does not affect the function and cannot be caught?

qouff edited in Fri, 25 Nov 2022

A strange bug, although the null pointer exception, but does not affect the function, but the console output is really eye-catching. I hope that the great God can point out what this is. The strange situation is as follows:` java.lang.NullPointerException

at org.apache.jsp.service.search_jsp._jspService(search_jsp.java:191)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at controller.service.search.searchServlet.doGet(searchServlet.java:78`
报错的源码:
`try {
        request.getRequestDispatcher("/service/search.jsp").forward(request, response);
    } catch (java.lang.NullPointerException e) {
        // System.err.println(e);
    }`

The results of the project are as follows:

0 Replies