This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 61086
    
  66

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: 41599
    
  55
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"