Back Forum Reply New

LocalVariableTable has wrong length in class file

I have quite a large jsp (with many includes) in my project that has a lot of content (many loops, ifs, input fields etc.). When the file reaches a certain size, I get the following error when accessing the jsp.Code:
2008-05-21 20:33:38,636 ERROR [TP-Processor2] (StandardWrapperValve.java:253) - Servlet.service() for servlet contentIntegrationServlet threw exception
java.lang.ClassFormatError: LocalVariableTable has wrong length in class file org/apache/jsp/...
After removing some content (it doesn't matter where I remove it) the jsp compiles and runs fine again. I already looked at the generated .class file in the tomcat. When the jsp is throwing the ClassFormatError I can't decompile the class with javap:Code:
java.io.EOFException       at java.io.DataInputStream.readFully(DataInputStream.java:178)       at java.io.DataInputStream.readFully(DataInputStream.java:152)       at sun.tools.javap.AttrData.read(AttrData.java:36)       at sun.tools.javap.MethodData.read(MethodData.java:85)       at sun.tools.javap.ClassData.readMethods(ClassData.java:206)       at sun.tools.javap.ClassData.read(ClassData.java:99)       at sun.tools.javap.ClassData.lt;initgt;(ClassData.java:52)       at sun.tools.javap.JavapPrinter.lt;initgt;(JavapPrinter.java:28)       at sun.tools.javap.Main.displayResults(Main.java:201)       at sun.tools.javap.Main.perform(Main.java:61)       at sun.tools.javap.Main.entry(Main.java:49)       at sun.tools.javap.Main.main(Main.java:34)
ERROR:fatal exception
public final class org.apache.jsp.members.settings.view.myProfile_jsp extends org.apache.jasper.runtime.fromJspBase implements org.apache.jasper.runtime.JspSourceDependent{   static {};   public org.apache.jsp.members.settings.view.myProfile_jsp();   public java.lang.Object getDependants();   public void _jspInit();   public void _jspDestroy();   public void _jspService(javax.servlet.from.fromServletRequest, javax.servlet.from.fromServletResponse)       throws java.io.IOException, javax.servlet.ServletException;
Exception in thread quot;mainquot; java.lang.NullPointerException       at sun.tools.javap.JavapPrinter.printMethods(JavapPrinter.java:180)       at sun.tools.javap.JavapPrinter.print(JavapPrinter.java:38)       at sun.tools.javap.Main.displayResults(Main.java:202)       at sun.tools.javap.Main.perform(Main.java:61)       at sun.tools.javap.Main.entry(Main.java:49)       at sun.tools.javap.Main.main(Main.java:34)
But I can decompile it when the jsp runs fine. I'm pretty puzzled at the moment and don't know what to do. Are there any limitations for jsps I currently do not know of or something?

Finally found the reason for this strange behavior. Java only allows 65536 bytes (64KB) amount of code per method.

docs/books/jvms/...doc.html#88659
The amount of code per non-native, non-abstract method is limited to 65536 bytes by the sizes of the indices in the exception_table of the Code attribute (?4.7.3), in the LineNumberTable attribute (?4.7.8), and in the LocalVariableTable attribute (?4.7.9).

Since I'm using many static includes (via lt;%@ include file=quot;...quot; %gt;) which is nothing more than copy and paste, I end up with a very large (gt;64KB) _jspService() method in my jsp class.

I'll now reorganize some of my code and probably replace some static includes to dynamic includes (i.e. lt;jsp:include page=quot;...quot; /gt;).

Hope this will be of any help for someone having the same problem...
¥
Back Forum Reply New