Unable to compile class for JSP,The code of method _jspService is exceeding the 65535 bytes limit

本文详细介绍了如何解决JSP页面加载时因文件过大导致的错误。通过在Tomcat的web.xml文件中添加特定参数,可以有效避免JSP编译过程中遇到的65535字节限制问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

jsp页面加载时出现如下错误:

Message Unable to compile class for JSP:
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: [178] in the generated java file: [D:\tomcat8\apache-tomcat-8.5.34\work\Catalina\localhost\stusv-estudent-main\org\apache\jsp\stusv\newstudents\listsafeguard\addAndEditNewstudentsListSafeguard_jsp.java]
The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

因为JSP文件太大了导致此错误。

找到Tomcat安装目录下conf文件夹下的web.xml文件,在如下位置,添加红色字体的参数。

<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>enablePooling</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>mappedfile</param-name>
<param-value>false</param-value>
</init-param>

<load-on-startup>3</load-on-startup>
</servlet>

之后重启Tomcat。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值