Pivotal Knowledge Base

Follow

Upgrading any Pivotal tc Server to version 3.0.2 and above causes JSP compilation error "HTTP Status 500 - Unable to compile class for JSP" on JSP pages

Environment

Product Version
Pivotal tc Server  3.0.2 onwards
Apache Tomcat 7.0.57.x and 8.0.15.x

 Symptom

When upgrading from any versions prior to 3.0.2 to Pivotal tc Server 3.0.2 and above, JSP compilation error may be caused if have users have any JSP pages containing invalid directives that end with a semicolon; for example, < %@ import="some_values;" % >.

For instance, after upgrading vFabric tc Server version 2.9.7 to Pivotal tc Server 3.1.0, when accessing the default ROOT (sample) application index.jsp, it returns the following JSP compilation error:

HTTP Status 500 - Unable to compile class for JSP
type Exception report

message Unable to compile class for JSP
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:672) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause java.lang.IllegalArgumentException: Page directive: invalid value for import org.apache.jasper.compiler.Node$PageDirective.validateImport(Node.java:628) org.apache.jasper.compiler.Node$PageDirective.addImport(Node.java:609) org.apache.jasper.compiler.Parser.parsePageDirective(Parser.java:343) ...

Cause

This is a known issue caused by Apache Tomcat 7.0.15+ and 8.0.15+ Jasper changes to ensure that semi-colons are not permitted in JSP import page directives to address another bug issue.

For details, see Apache Tomcat 7.0.57 (also applied to 8.0.15) changelog of the Jasper section:

Notice that the above JSP compilation error is caused by this invalid import directive in the ROOT/index.jsp that ends with a semicolon as shown below.

<%@ page import="org.apache.catalina.util.ServerInfo;" session="false" %>

For tc Server, the upgrade option on both Windows and Linux platforms is not designed to modify the ROOT or any other Applications, so it will not remove the ending ";" from any import directives during an upgrade process.

Resolution

  • For default ROOT application, the user can simply fix the JPS compilation error by removing the ";" from the import directive in the index.jsp page.
  • For any other applications with JSP compilation error due to invalid import value, users must make sure there are no semicolons (";") at the end of any import directives on their JSP pages.

Note

  • The tc Server 3 upgrade option is not designed to touch (modify) the tcServer instance applications including the default ROOT app, therefore it will not remove any JSP pages that have the ending ";" in any import directives.  It is up to users to remove any import directives ending with ";" from the JSP web application in order to adhere to Jasper changes in Apache Tomcat 7.0.57+ and 8.0.15+.

Comments

Powered by Zendesk