_jspService is exceeding the 65535 bytes limit

喜你入骨 提交于 2019-12-27 12:01:09

问题


So I'm dealing with a legacy servlet code that runs on Websphere 7 (JDK 6). Development environment setup uses Tomcat 6 (JDK 6).

  1. Why does it work on Websphere 7 and not in Tomcat 6?
  2. Is this something related to the application server?

If your answer is yes for no. 2, do you have a workaround for this on Tomcat 6 (JDK 6) aside from breaking down the code or using dynamic includes?

The schedule does not agree with changing static includes to dynamic includes primarily because most pages are coupled with the business model code including the main template of the app.


回答1:


It sounds like you're hitting a 64k method limit, probably due to how Tomcat builds a class out of your JSP. This page suggests changing your static includes like this:

<%@ include file="test.jsp" %>

To dynamic includes like this to avoid the issue:

<jsp:include page="test.jsp" /> 



回答2:


I ran out of static html/jss/css blocks I could externalize into jsp:include (mostly non-static html was left) ...

You can put in your web.xml, mappedfile set to false like so to get rid of many static lines that aren't necessarily good blocks to put into an include, but they add up to save space:

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

Peter Hart's <c:catch> solution sounds like nice option as well.




回答3:


Better to point direct where to change it as stated in following link: https://www.assetbank.co.uk/support/documentation/knowledge-base/byte-limit-exceeded-error/

Locate the file [Tomcat_Home]/conf/web.xml and search the file for 'JspServlet'. This should return an xml node of <servlet> containing some <init-param> values. You will need to add an additional <init-param> the same as the below.

<init-param>
    <param-name>mappedfile</param-name>
    <param-value>false</param-value>
</init-param> 

That's more clear and direct for tomcat user

Other reference solutions that of course, mostly said in previous comment but all in one place to read, here: http://answered.site/development-environment-setup-uses-tomcat-6-jdk-6-why-does-it-work/603017/

The issue also found in tomcat-8 with JDK1.8 (Java8)




回答4:


Sometimes breaking your JSP into includes doesn't make sense or doesn't work. Another way to force your JSP to be broken into separate methods when compiled is to separate your JSP into segments using <c:catch>.




回答5:


For JBoss eap 6 in standalone.xml add the below code under web subsytem.

<configuration>
    <jsp-configuration development="true" mapped-file="false"/>
</configuration>

It resolved my issue.




回答6:


Why does it work on Websphere 7 and not in Tomcat 6

Because they have different JSP compilers that translate the JSPs to different Java code. The Tomcat JSP compiler (Jasper) is apparently not able to deal with large JSPs.

Perhaps the next question is, is it possible to change the method size limit of the JVM?

No. These limits are hard-wired into the format / structure of class files.

The details are in the JVM spec ... but it is rather complicated, and it is not entirely clear from your question which limit you have hit. (But that is immaterial ... they can't be changed.)




回答7:


By setting initialization parameter "mappedFile" to "false" worked for me.

But using eclipse plugin some time it is getting removed and need to again set in tomcat home.




回答8:


I stumbled across this issue today
My problem was solved as I took Tomcat 8.0.30 instead of Tomcat 8.0.39




回答9:


For wildfly server, In standalone.xml -> inside undertow subsystem : replace jsp-config with

<jsp-config development="true" mapped-file="false"/>



回答10:


Eidt: Given solution was no solution, but missinterpreation (problem can not be reproduced on all tomcat versions) sorry.



来源:https://stackoverflow.com/questions/5484253/jspservice-is-exceeding-the-65535-bytes-limit

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