wood burning stoves 2.0
The moose likes Struts and the fly likes code too large for try statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "code too large for try statement" Watch "code too large for try statement" New topic

code too large for try statement

Michael Beck

Joined: Mar 11, 2005
Posts: 19
I ran into a baffling problem yesterday with a jsp. Using the struts tag library, I had a logic:iterate over a large block of code that displays a lot of data which also had some iterates in side of it. Upon trying run the page on a WAS server, I got the compile error "unable to compile class for jsp...code too large for try statement..."
Apparently the struts logic tag generates a try/catch statement when the java class is compiled. I solved the problem by getting rid of the logic:iterate tag and using a scriptlet to iterate over the code.

Has anyone seen this before, or have any insight into why this is the case?

Thanks in advance.
Michael Beck

Joined: Mar 11, 2005
Posts: 19
thank for the move, but this isn't a struts issue. after further research, the problem seems to be that the servlet container (WAS) is this instance compiles the jsp into a java file in which all of the code is contained within a try/catch block.

from http://publib.boulder.ibm.com/infocenter/wasinfo/v4r0/index.jsp?topic=/com.ibm.support.was.doc/html/Java_SDK/1177375.html

The Java� specification states that there is a 64 K limit on the size of methods in Java. The JVM� does not execute methods that exceed this limit.

It is possible to compile methods larger than 64 K, but the JVM will not run these methods. Consequently, the error occurs during runtime, while attempting to execute Java methods that are greater than 64 K.

A code too large for try statement error can still be issued while compiling a JSP. The compiler limitation does not allow try/catch blocks to have a start or end location greater than 64 K into the method code. Therefore, compiler limitations are usually caught when a try/catch block overlaps the 64 K boundary.
I agree. Here's the link: http://aspose.com/file-tools
subject: code too large for try statement
It's not a secret anymore!