• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jsp file length must be within 1200 lines
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic