Bug 63597

Summary: use of unimplemented RequestUtil method in Host-Manager page
Product: Tomcat 9 Reporter: J <joerg.schaible>
Component: UtilAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: andreas.ofenboeck
Priority: P2    
Version: 9.0.22   
Target Milestone: -----   
Hardware: PC   
OS: Linux   
Bug Depends on: 62049    
Bug Blocks:    

Description J 2019-07-23 09:35:23 UTC
Jasper's compilation of jsp 404 error page, in the host-manager app, fails.

This is the same problem as in #62049, but this time in the host-manager instead of the manager application:

============== %< ===============
~/opt/apache-tomcat-9.0.22/webapps $ find . -name "*.jsp" -exec grep RequestUtil {} + 
./host-manager/WEB-INF/jsp/404.jsp:<%@ page import="org.apache.catalina.util.RequestUtil" session="false"
./host-manager/WEB-INF/jsp/404.jsp:    (<%=RequestUtil.filter((String) request.getAttribute(
============== %< ===============

We get these exceptions in the log:

============== %< ===============
Jul 23, 2019 11:33:07 AM org.apache.catalina.core.StandardHostValve custom
SEVERE: Exception Processing ErrorPage[errorCode=404, location=/WEB-INF/jsp/404.jsp]
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: [36] in the jsp file: [/WEB-INF/jsp/404.jsp]
The method filter(String) is undefined for the type RequestUtil
33:    <h1>404 Not found</h1>
34:    <p>
35:     The page you tried to access
36:     (<%=RequestUtil.filter((String) request.getAttribute(
37:             "javax.servlet.error.request_uri"))%>)
38:     does not exist.
39:    </p>


Stacktrace:
	at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:213)
	at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:522)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:392)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:346)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
	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.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:461)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:394)
	at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:834)
============== %< ===============
Comment 1 Mark Thomas 2019-07-24 15:29:50 UTC
Thanks for the report.

Fixed in:
- master for 9.0.23 onwards
- 8.5.x for 8.5.44 onwards

7.0.x is not affected.
Comment 2 Mark Thomas 2019-07-31 11:51:25 UTC
*** Bug 63622 has been marked as a duplicate of this bug. ***