https://issues.apache.org/bugzilla/show_bug.cgi?id=53958
Priority: P2 Bug ID: 53958 Assignee: dev@tomcat.apache.org Summary: Custom error page generates NPE in StandardHostValve.java Severity: normal Classification: Unclassified Reporter: sro...@gmail.com Hardware: Macintosh Status: NEW Version: 7.0.30 Component: Catalina Product: Tomcat 7 I've defined a custom error page, /error.jspx. When I access it directly in Tomcat, the page serves, but I see this in the logs: SEVERE: Exception Processing ErrorPage[errorCode=404, location=/error.jspx] java.lang.NullPointerException at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:456) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:327) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:193) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680) Because the page serves (it just says "Error!"), I believe that part is fine, including its declaration as a JSPX file and such. This error page is mapped to common error codes and exceptions too. I am using Tomcat as an embedded server, so, proceeding like: ErrorPage errorPage = new ErrorPage(); errorPage.setErrorCode(404); errorPage.setLocation("/error.jspx"); context.addErrorPage(errorPage); I also get the exception above when generating a 404 error on purpose. In this case, the error page does not show; I see a default Tomcat error page. It seems like the RequestDispatcher for the error page is null in this situation. I am not sure why. I know it's null if the page is outside the web app context, but it isn't here. I think. I am configuring the one and only context for the web app thusly.. Context context = tomcat.addContext("/", contextPath.getAbsolutePath()); Is this my error? a bug? -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org