On 22/07/2020 13:01, Максим Фастовец wrote: > 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.
Unlikely. What you will get is a completely unsupported configuration that may exhibit subtle bugs that you will have sole responsibility for fixing. If you really want to go that route and you are happy that it works for you then, fair enough, that is your choice. But if you go down that route you are entirely on your own. > 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! Possibly because Tomcat doesn't use javac to compile JSPs. At least not by default. It uses the Eclipse Compiler for Java. I suspect your time would be better spent refactoring the JSPs that are currently exceeding the 64k limit and then running on a supported configuration. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org