Tomcat is unable to compile a JSP which has a too long section of pure html in it. Because during jsp -> java operation jasper is creating 1 method per enclosing tag (+one jsp service method for root content), jasper is sometimes unable to compile a jsp. This happens because jasper splits the JSP at line break and converts them to out.print("......\n"); Nowhere in jsp specs is a limit mentioned on the number of lines. However, each out.println() is using a bit of code space, and you finally end up hitting the compiler limit of 64k maximum size of code for a method. and you get this: The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:413) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264) one solution would be to rerun the .java generator when such a compilation error with an hint telling it to split this method's content in 2 or more methods.
Look at the second bullet of section 4.10 at http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#1513. It's a JLS limitation.
Sorry, I submitted a little too early, didn't finish writing what I meant to say. It's a JLS limitation on method size as I said, but I understand you run up against that limit because of Jasper's java generation. I myself am reluctant to change the generator for this case, because I'm not sure it's very prevalent, and it seems easy to work around on your end (by splitting up the JSP). However, if you want this feature enough to sumbit a patch for it, I'll be glad to review that patch.
This is an enhancement, marking it as such.
*** Bug 42958 has been marked as a duplicate of this bug. ***
Please note, that there is a configuration option in the JspServlet, "mappedfile". If set to "false", adjacent println statements will be merged into a single one. See http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html#Configuration and the comments in conf/web.xml If you need anything else, implementable ideas and patches are welcome.