文章 > xujing > 文章详情
JSP文件过大编译失败,异常如is exceeding the 65535 bytes l...
Small  xujing  发表于 2年前  来自话题 #应用开发平台(EOS Platform)#  · 

15124 浏览
摘要:JSP文件过大无法编译,后台抛异常Generated servlet error:The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit,建议修改web.xml加入初始化参数,应该能有所改善。

问题描述

项目中使用SCE表单,字段很多,使用的控件多,造成JSP文件过大,在表单预览时后台抛异常The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

[super][2014-10-16 11:41:15,794][ERROR][org.gocom.components.coframe.policy.RulesIpFilter:49] Error to Filter url of http://www.bb.mac:8080/super/ap_web/ZY09A/ZY09A_1__form.jsp

org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to compile class for JSP

 

Generated servlet error:

The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

 

 

    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)

    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)

    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

    ......

    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

    at java.lang.Thread.run(Thread.java:695)

Caused by: org.apache.jasper.JasperException: Unable to compile class for JSP

 

Generated servlet error:

The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

 

 

    at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)

    at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)

    at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)

    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)

    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)

    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)

    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)

    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)

... 73 more

解决方案

空行的去除没有帮助,减少引用的js会有小帮助,但在jsp本身很大的时候作用有限。建议尝试修改应用服务器的web.xml文件(tomcat下位于conf目录下,在jboss下位于server\default\deploy\jbossweb.sar目录下 ),修改如下图所示之处,加入红框内的初始化参数。

 

 

1 个回应
Normal
yangle123 2015年03月25日 10:01

java类文件不允许超过65K,如果遇到类似情况,还有几个方法可以考虑:

    1、将JSP里面的代码按逻辑分割写成java类的方法调用。

    2、拆分JSP文件。

    3、使用<jsp:include  page="a.jsp"/>替换%@include file="a.jsp" % >

需要 后方可回复
如果没有账号可以 一个帐号。