The code of method is exceeding bytes limit exception

When hooking/extending some liferay jsp and exceeding the 65535 bytes limit you will get following exception:

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:468)
...
To solve this issue follow this steps:

1. change from static include to dynamic include:

 static:
<%@include file="test.jspf"%>
 dynamic:
<jsp:include page="test.jsp" />
2. rename included *.jspf to *.jsp

3. redeclare variables necessary in the included *.jsp

Leave a Reply