How to fix the error The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit Jboss

戏子无情 提交于 2020-05-17 06:45:11

问题


I was encountering An error occurred at line: 384 in the generated java file The code of method

_jspService(HttpServletRequest, HttpServletResponse)

is exceeding the 65535 bytes limit.

I have tried several solution around the web and issue still persists.

I am using Jboss-5.1.0 GA as the server.

Here are the stacktrace of the error.

An error occurred at line: 384 in the generated java file
The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

    Stacktrace:
            at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
            at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
            at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
            at org.apache.jasper.compiler.Compiler.compile(Compiler.java:335)
            at org.apache.jasper.compiler.Compiler.compile(Compiler.java:313)
            at org.apache.jasper.compiler.Compiler.compile(Compiler.java:300)
            at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
            at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:543)
            at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:480)
            at com.liferay.portlet.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:307)
            at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:115)
            at com.liferay.portal.struts.PortletRequestProcessor.doInclude(PortletRequestProcessor.java:284)
            at com.liferay.portal.struts.PortletRequestProcessor.doForward(PortletRequestProcessor.java:255)

回答1:


Your JSP is too large / too complicated. You need to refactor it

We tried refactoring but its not working are there any alternate solutions?

No.

The problem is that there is a hard limit imposed by the Java virtual machine specification on the number of bytes of bytecode in a compiled Java method. (Specifically, the classfile format uses a 16 bit number as the sides of the method's code array.)

Java compilers are not able to automatically split a method that is too large into sub-methods. You have to do it yourself at the source code level.

With JSPs, the JSP compiler translates each JSP into a class with a single (large) Java method, unless you can refactor it by either moving some of logic into separate methods, classes or ... JSPs using "dynamic includes"; see https://stackoverflow.com/a/5484509/139985.)



来源:https://stackoverflow.com/questions/58444809/how-to-fix-the-error-the-code-of-method-jspservicehttpservletrequest-httpserv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!