JSP compilation failure with the error message "JAVAC MESSAGE FILE IS BROKEN: key=javac.err.branch.too.big" or "code too large for try statement"
 Technote (FAQ)
 
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.

Refer to the "4.10 Limitations of Java Virtual Machines" section in http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html

 
Solution
Browser-based compilation on WebSphere Application Server V4.0 and V5.0 releases

Set the JVM™ system property com.sun.tools.javac.main.largebranch to true. After setting this property to true, restart the server and request the JSP. If this compilation error persists after correctly setting this property, restarting the server and requesting the JSP, see Best practices for reducing the size of the service method in generated JSP class files

To change the system property in WebSphere Application Server V4.0 releases:
  1. Go to the administrative console.
  2. Select WebSphere Administrative Domain > Nodes > your_node_name > Application Servers > your_application_server
  3. On the right, click JVM Settings.
  4. Under System Properties, click Add.
  5. Under name specify com.sun.tools.javac.main.largebranch without quotes and under value specify true without quotes.
  6. Click Apply.
  7. Restart the Application Server to pickup the changes.

To change the system property in WebSphere Application Server V5.0 releases:
  1. In the administrative console, expand Servers, then click Application Servers.
  2. Select the Application Server.
  3. In the Additional Properties section, click Process Definition.
  4. Click Java Virtual Machine.
  5. Click Custom Properties.
  6. Click New.
  7. Under name specify com.sun.tools.javac.main.largebranch without quotes and under value specify true without quotes.
  8. Click Apply.
  9. At the top of the administrative console, click Save to save your changes.
  10. Stop and restart the Application Server.


Browser-based compilation on WebSphere Application Server V5.1 releases

There is no further optimization that can be done in the Application Server. See Best practices for reducing the size of the service method in generated JSP class files

Batch compilation in WebSphere Application Server V4.0, V5.0 and V5.1 releases

By default, the WebSphere Application Server JSP Batch Compiler is fully optimized. If this compilation error is encountered when using the JSP Batch Compiler, see Best practices for reducing the size of the service method in generated JSP class files
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > JSP
Operating system(s): Windows
Software version: 5.1
Software edition:
Reference #: 1170472
IBM Group: Software Group
Modified date: Mar 25, 2005