This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes When executing a JSP i get  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "When executing a JSP i get  "Code too large for try statement"" Watch "When executing a JSP i get  "Code too large for try statement"" New topic
Author

When executing a JSP i get "Code too large for try statement"

Todd Baxter
Greenhorn

Joined: Sep 26, 2007
Posts: 18
happens on Resin 3.0.14.

The JSP size is 87063 bytes.
The corresponding servlet JAVA file is 444569 bytes

Is there a limit?

Using JDK 6.0
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Wow. Why do you have so much code in your JSP? Why do you have any code in your JSP?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
Hi,

I agree with Bear. You ought use right layer. For example - put your business logic in business layer and data base related to DAO layer. Otherwise, it would be a nightmare for you.

Thanks
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
jsp file length must be within 1200 lines
spike gomez
Greenhorn

Joined: Nov 12, 2008
Posts: 2
Ah so jsp lines must be within 1200 lines not more than that??
Now I know, thanks for the information...


<a href="http://www.metrorp.com" target="_blank" rel="nofollow">Rapid Prototyping</a>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
I don't think any limit on JSP pages are related to the number of lines contained in them. Most limits (overall code size, number of methods, etc.) originate from the limitations of class files, which is what JSPs end up being.

As such, the limitations are also dependent on which servlet container and which compiler is used, because different servlet containers (and different compilers) will produce different class file output.

In any case, JSPs should not be as big as 87063 bytes, and much shorter than 1200 lines (and, as Bear said, they shouldn't contain Java code to begin with). Try to break them into smaller pieces by making use of includes.


Ping & DNS - my free Android networking tools app
Todd Baxter
Greenhorn

Joined: Sep 26, 2007
Posts: 18
Problem A JavaServer Pages� (JSP�) page compilation may fail with the error message "JAVAC MESSAGE FILE IS BROKEN: key=javac.err.branch.too.big" or "code too large for try statement". Cause There is a limitation of 65536 bytes (64K) on the amount of code per non-native, non-abstract method in Java� SDK classes. If a JSP page is translated into a Java class in which this limit is exceeded, the Java compiler will issue a "JAVAC MESSAGE FILE IS BROKEN: key=javac.err.branch.too.big" or "code too large for try statement" message, and the JSP compilation will fail. The JVM method size limit of 64K cannot be increased.


-------------
Its not that the JSP has scriptlet code. We have a ton of custom tags that we use and there is just too much markup that ends up being one huge "service()" method of the underlying servlet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When executing a JSP i get "Code too large for try statement"
 
Similar Threads
Display Pdf Content
Writing Image on Stream
Help needed- Options for increasing performance
How send byte stream? (Instead of pointing to file)
java.lang.ClassFormatError: org/apache/jsp/wfDigital_jsp (Code of a method longer tha