Bug 61723 - The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit
Summary: The code of method _jspService(HttpServletRequest, HttpServletResponse) is ex...
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 7.0.75
Hardware: PC Linux
: P2 critical (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-04 23:35 UTC by Thiago Moreira
Modified: 2017-11-08 09:46 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Moreira 2017-11-04 23:35:28 UTC
Hi there, 

I'm facing the following exception on versions newer than 7.0.73, for instance 7.0.75 to 7.0.82.

nov 04, 2017 11:31:01 PM org.apache.catalina.core.ApplicationDispatcher invoke
GRAVE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: [427] in the generated java file: [/opt/liferay/tomcat/work/Catalina/localhost/_/org/apache/jsp/html/common/themes/portlet_jsp.java]
The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

Stacktrace:
	at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
	at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:490)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

If I add the following configuration (conf/web.xml) to any 7.0.73+ version I still get the exception, from my research these settings should avoid the problem, am I right?

    <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>checkInterval</param-name>
            <param-value>300</param-value>
        </init-param>
        <init-param>
            <param-name>development</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>mappedfile</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>xpoweredBy</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>

I don't have access to the JSP that throw the exception.
Comment 1 Mark Thomas 2017-11-08 09:46:13 UTC
Changes were made to the way code was generated for JSPs to resolve some bugs (that were also spec compliance issues) with resource clean-up if a tag throws an Exception. We minimised the impact of these as much as we can but the end result is still that the generated code is larger than it was before.

There are some useful pointers in this thread.
http://markmail.org/thread/5gh57ststsbjqbza

Note:
trimSpaces - true       should be zero impact and might help
enablePooling - false   is likely to have a negative performance impact