Hi!

We're working on moving an old legacy Servlet/JSP web app from WebSphere to
Tomcat to cut our expenses. I figured out that the latest version of Tomcat
where our web app runs without 'The code of method
_jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535
bytes limit' error is 8.0.36. I also needed to tune some init-params in
${TOMCAT8.0.36.HOME}/conf/web.xml for JspServlet section:

<init-param>
   <param-name>mappedfile</param-name>
   <param-value>false</param-value>
</init-param>
<init-param>
   <param-name>classdebuginfo</param-name>
   <param-value>false</param-value>
</init-param>
<init-param>
   <param-name>displaySourceFragment</param-name>
   <param-value>false</param-value>
</init-param>
<init-param>
   <param-name>dumpSmap</param-name>
   <param-value>false</param-value>
</init-param>
<init-param>
   <param-name>suppressSmap</param-name>
   <param-value>true</param-value>
</init-param>
<init-param>
   <param-name>trimSpaces</param-name>
   <param-value>true</param-value>
</init-param>

I also figured out that it is jasper.jar and jasper-el.jar which somehow
serve to precompile JSPs. So if I replace $TOMCAT9_HOME/lib/jasper.jar and
$TOMCAT9_HOME/lib/jasper-el.jar with $TOMCAT8.0.36_HOME/lib/jasper.jar and
$TOMCAT8.0.36_HOME/lib/jasper-el.jar respectively I'll get our legacy web
app running on Tomcat 9 as well without that '64k bytes limit' error.

But when I follow this suggestion to precompile JSPs using Tomcat 8.0.36
distr dir as ${tomcat.home} I am getting  'error: code too large public
void _jspService(final javax.servlet.http.HttpServletRequest request, final
javax.servlet.http.HttpServletResponse response)' error. I added all the
init-params to jasper ant task I added to JspServlet section in
${TOMCAT8.0.36.HOME}/conf/web.xml but still precompilation fails

<jasper
  validateXml="false"
  mappedFile="false"
  smapDumped="false"
  smapSuppressed="true"
  trimSpaces="true"
  classdebuginfo="false"
  uriroot="${webapp.path}"
  failOnError="false"
  webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
  outputDir="${webapp.path}/WEB-INF/src" />

I also tried running the <jasper /> task without 'compiler' attribute and
changing 'compiler' attribute to all possible values mentioned here:
https://ant.apache.org/manual/Tasks/javac.html#compilervalues but looks
like it doesn't affect the task at all.

I tried it with ant 1.9.15 and with 1.9.7 and still got that 'code too
large' error.

Can you please tell why Tomcat 8.0.36 compiles huge JSPs fine but
precompiling JSPs with jspc + javac fails with code too large error? And
how to fix it? Thank you!

I also raised this question on StackOverflow but still haven't got any
answers: https://stackoverflow.com/q/62955156/6807541

Kind Regards,
Maks.

Reply via email to