Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Todd Baxter
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow. Why do you have so much code in your JSP? Why do you have any code in your JSP?
 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jsp file length must be within 1200 lines
 
spike gomez
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah so jsp lines must be within 1200 lines not more than that??
Now I know, thanks for the information...
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Todd Baxter
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic