_jspService 超出 65535 字节限制

发布于 2024-10-27 15:48:30 字数 300 浏览 1 评论 0 原文

因此,我正在处理在 Websphere 7 (JDK 6) 上运行的遗留 servlet 代码。开发环境设置使用Tomcat 6 (JDK 6)。

  1. 为什么它可以在 Websphere 7 上运行 Tomcat 6 中没有吗?
  2. 这是否与以下内容有关 应用服务器?

如果你的答案是“是”或“否”。 2,除了分解代码或使用动态包含之外,您在 Tomcat 6 (JDK 6) 上还有解决方法吗?

该计划不同意将静态包含更改为动态包含,主要是因为大多数页面都与业务模型代码(包括应用程序的主模板)耦合。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

烟花肆意 2024-11-03 15:48:30

听起来你正在打 64k 方法限制,可能是由于 Tomcat 如何从 JSP 构建类所致。 此页面建议更改您的静态包含,如下所示

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

:动态包括这样以避免这个问题:

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

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" /> 
帅气尐潴 2024-11-03 15:48:30

我用完了可以外部化为 jsp:include 的静态 html/jss/css 块(大部分是非静态 html)...

您可以放入 web.xml code>,mappedfile 设置为 false 像这样删除许多静态行,这些静态行不一定是放入包含的好块,但它们加起来可以节省空间:

<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 的 解决方案听起来也是不错的选择。

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.

萌︼了一个春 2024-11-03 15:48:30

最好直接指出更改位置,如以下链接所述:
https://www.assetbank.co。 uk/support/documentation/knowledge-base/byte-limit-exceeded-error/

找到文件 [Tomcat_Home]/conf/web.xml 并在该文件中搜索“JspServlet”。这应该返回 的 xml 节点,其中包含一些 值。您需要添加一个额外的 ,如下所示。

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

这对于 tomcat 用户来说更加清晰和直接

其他参考解决方案当然主要在之前的评论中提到,但都在一个地方阅读,这里: http://answered.site/development-environment-setup-uses-tomcat-6-jdk-6-why-does-it-work/603017/

Tomcat 中也发现了该问题-8 与 JDK1.8 (Java8)

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)

九厘米的零° 2024-11-03 15:48:30

有时将 JSP 分解为包含内容没有意义或不起作用。另一种强制 JSP 在编译时分解为单独方法的方法是使用 将 JSP 分成多个段。

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>.

清泪尽 2024-11-03 15:48:30

对于 JBoss eap 6,请在standalone.xml 中的Web 子系统下添加以下代码。

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

它解决了我的问题。

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.

岁月静好 2024-11-03 15:48:30

为什么它在 Websphere 7 上工作而在 Tomcat 6 上不起作用

因为它们有不同的 JSP 编译器,可以将 JSP 转换为不同的 Java 代码。 Tomcat JSP 编译器(Jasper)显然无法处理大型 JSP。

也许下一个问题是,是否可以更改 JVM 的方法大小限制?

不。这些限制是硬连接到类文件的格式/结构中的。

详细信息位于 JVM 规范 中。但它相当复杂,从你的问题中并不完全清楚你达到了哪个限制。 (但这并不重要......它们无法更改。)

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.)

人事已非 2024-11-03 15:48:30

通过将初始化参数“mappedFile”设置为“false”对我有用。

但使用 eclipse 插件有时会被删除,需要在 tomcat home 中重新设置。

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.

总以为 2024-11-03 15:48:30

我今天偶然发现了这个问题
当我使用 Tomcat 8.0.30 而不是 Tomcat 8.0.39 时,我的问题得到了解决

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

小糖芽 2024-11-03 15:48:30

如果您要在 带有嵌入式 tomcat 的 Spring Boot 上修复此错误 _jspService is超过 65535 字节限制,您可以在 application.properties 中使用此配置代码>:

server.servlet.jsp.init-parameters.mappedfile=false

If you are going to fix this error _jspService is exceeding the 65535 bytes limit on Spring Boot with embedded tomcat you can use this config in your application.properties:

server.servlet.jsp.init-parameters.mappedfile=false
笑咖 2024-11-03 15:48:30

Eidt:给定的解决方案没有解决方案,但错误解释(问题不能在所有 tomcat 版本上重现)抱歉。

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

浮华 2024-11-03 15:48:30

对于wildfly服务器,在standalone.xml中->在 undertow 子系统内:将 jsp-config 替换为

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

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

<jsp-config development="true" mapped-file="false"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文