现在的位置: 首页 > 综合 > 正文

一个JSP编译错误的解决:JAVAC MESSAGE FILE IS BROKEN: key=javac.err.branch.too.big

2013年10月03日 ⁄ 综合 ⁄ 共 6027字 ⁄ 字号 评论关闭
日志中提示如下错误:
[06-5-17 9:09:40:391 CST] 1a9f74ca WebGroup      E SRVE0026E: [Servlet 错误]-[无法编译 JSP 类
D:/IBM/WebSphere/AppServer/temp/zxsjk7/server1/ai_war/ai.war/home/_main.java:14: JAVAC MESSAGE FILE IS BROKEN: key=javac.err.branch.too.big, arguments=null, null, null
public class _main extends com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase {
             ^
1 个错误
]:org.apache.jasper.JasperException: 无法编译 JSP 类
D:/IBM/WebSphere/AppServer/temp/zxsjk7/server1/ai_war/ai.war/home/_main.java:14: JAVAC MESSAGE FILE IS BROKEN: key=javac.err.branch.too.big, arguments=null, null, null
public class _main extends com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase {
             ^
1 个错误

    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:129)
    at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.compile(JspServlet.java:1003)
    at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.loadJSP(JspServlet.java:925)
    at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:287)
    at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:317)
    at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:700)
    at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:798)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java(Compiled Code))
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java(Compiled Code))
    at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java(Compiled Code))
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java(Inlined Compiled Code))
    at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java(Compiled Code))
    at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java(Compiled Code))
    at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java(Inlined Compiled Code))
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java(Compiled Code))
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java(Compiled Code))
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled Code))
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java(Compiled Code))
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java(Compiled Code))
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java(Compiled Code))
    at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java(Compiled Code))
    at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java(Compiled Code))
    at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java(Compiled Code))
    at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java(Compiled Code))
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java(Compiled Code))
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java(Compiled Code))
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
解决方法及相关信息如下:(原文URL:http://www-1.ibm.com/support/docview.wss?rs=180&context=SSEQTP&q1=1170472&uid=swg21170472&loc=en_US&cs=utf-8&lang=en+en)


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:
Go to the administrative console.
Select WebSphere Administrative Domain > Nodes > your_node_name > Application Servers > your_application_server
On the right, click JVM Settings.
Under System Properties, click Add.
Under name specify com.sun.tools.javac.main.largebranch without quotes and under value specify true without quotes.
Click Apply.
Restart the Application Server to pickup the changes.

To change the system property in WebSphere Application Server V5.0 releases:
In the administrative console, expand Servers, then click Application Servers.
Select the Application Server.
In the Additional Properties section, click Process Definition.
Click Java Virtual Machine.
Click Custom Properties.
Click New.
Under name specify com.sun.tools.javac.main.largebranch without quotes and under value specify true without quotes.
Click Apply.
At the top of the administrative console, click Save to save your changes.
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 
 

抱歉!评论已关闭.