Andrea Girardi - It's my blog!

Tag: tomcat

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.

Velocity generates NullPointerException while evaluating template

While evaluating template with Velocity I am affecting a null point exception but happened only on production environment because it seems that the application is trying to write to tomcat/bin the velocity.log file but it failed due to the permission. I tried to add velocity.property file:

# Fri Dec  6 10:14:26 EST 2013 - Mandatory to prevent Velocity null point exception
runtime.log.logsystem.class=org.apache.velocity.runtime.log.NullLogSystem

but, after every startup I get the same error and, to fix that, it seems to be mandatory to remove the workdir tomcat folder. It’s not acceptable so, I tried to add this row before init the velocity:

Velocity.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogSystem");

Of course, my next step is to migrate to Freemarker because Velocity isn’t really under active development any more.

Copyright © 2017 Andrea Girardi – It's my blog!

Theme by Anders NorenUp ↑