Reproducible in Tomcat 7 on 7.0.47 and on the current 7.0.x (@ r1548765). I have not tested Tomcat 8. Steps to reproduce: 1. Create the file webapps/ROOT/test.jsp in the default ROOT web application. [[[ <% throw new RuntimeException(); %> ]]] 2. Configure JAVA_HOME to point to a Java 7 JRE (7u45). 3. Start Tomcat 4. Browse http://localhost:8080/test.jsp The following stacktrace is printed on the error page and into the log files: [[[ org.apache.jasper.JasperException: An exception occurred processing JSP page /test.jsp at line 1 1: <% throw new RuntimeException(); %> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ]]] The "WsFilter" in the stacktrace is unexpected, as the default ROOT web application does not use WebSockets.
This is not really that different from saying that a web application that doesn't use JSPs still has a JspServlet instance or a web application that doesn't use sessions still has a session manager. As discussed on the users list we could add a attribute to the Context to specify a regular expression for SCI implementation classes that should be ignored. I'm changing this to an enhancement request to do exactly that.
I have patched 8.0.x and 7.0.x so the filter is only added if a web application has active WebSocket Endpoints. I think there is still merit in disabling the SCI since that will remove the need for the annotation scan.
A new option, containerSciFilter, has been added to the Context in 8.0.x and will be included in 8.0.0 onwards.
The option has been back-ported to 7.0.x and will be included in 7.0.51 onwards.
Historical notes: (In reply to Mark Thomas from comment #2) > I have patched 8.0.x and 7.0.x so the filter is only added if a web > application has active WebSocket Endpoints. I think there is still merit in > disabling the SCI since that will remove the need for the annotation scan. 1. The change described above was later reverted because of a regression: it broke programmatic configuration of endpoints. The regression was reported in "[VOTE] Release Apache Tomcat 8.0.0-RC9" thread. http://tomcat.markmail.org/thread/2zmfqvveg3xhegwq This is the reason why the WsFilter installation cannot be skipped in a web application that uses websockets. The change: r1551356 Reverting the change: r1552076 2. As part of review for this issue, performance of WsFilter was improved in r1552083. Change log message: "Don't do the expensive 'Is this a WebSocket upgrade request check' if no endpoints have been registered" (In reply to Mark Thomas from comment #3) > A new option, containerSciFilter, has been added to the Context in 8.0.x and > will be included in 8.0.0 onwards. 3. Note, that "containerSciFilter" option can be used to explicitly disable WebSocket support for a selected web application (or globally via the default context configuration file). http://tomcat.apache.org/tomcat-8.0-doc/config/context.html http://wiki.apache.org/tomcat/HowTo/FasterStartUp