How do I fix a 65535 bytes limit Stacktrace?

It is possible that after an upgrade you may encounter this error on some of the more complex pages and root cause provided by tomcat console is :

Unable to compile class for JSP
 The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

To solve the issue you need to locate the file [Tomcat_Home]/conf/web.xml and search the file for ‘JspServlet’. This should return an xml node of containing some values. You will need to add an additional the same as the below.

<init-param>      
        <param-name>mappedfile</param-name>      
        <param-value>false</param-value> 
</init-param>

The resulting block of the web.xml file, once you have inserted the above, should look like the code below.

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

Save the file and restart the Tomcat service.

Tagged ,