Tomcat can not forward error code 500 when the page too large











up vote
0
down vote

favorite












My environment:
ubuntu 18.04
openjdk version "1.8.0_181"
tomcat 7.0.91



And I put these into WEB-INF/web.xml



<error-page>
<error-code>500</error-code>
<location>/500.html</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/500.html</location>
</error-page>


Now I write a test.jsp as:



<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<c:forEach begin="1" end="1000" step="1" var="i">
just test exception forward.
</c:forEach>
<%
Object o = null;
String s = o.toString();
%>
</body>
</html>


It will get an exception and goto /500.html. but it can not, when the exception, it just include the 500.html into current page.



I think the page is too large, if I put end="100" of c:forEach, it will forward 500.html.



How to fix this please?










share|improve this question




















  • 1




    You need to understand that at some point the servlet container (Tomcat) decides to actually start sending data over the wire (usually when an output buffer reaches some threshold). If anything happens after that point, there is nothing much a server can do to take back the data that has already been sent. docs.oracle.com/javaee/6/api/javax/servlet/…
    – Pavel Horal
    Nov 11 at 0:51












  • @PavelHoral Thank you. and is there a parameter to adjust buffer-size please?
    – xunitc
    Nov 11 at 0:57






  • 1




    I am not sure as I never needed to change such thing.... maybe socket.appWriteBufSize tomcat.apache.org/tomcat-8.5-doc/config/http.html . But I would say you just need to write your app in a different way... maybe don't write Java code into JSP as that is considered a bad practice.
    – Pavel Horal
    Nov 11 at 1:57












  • @PavelHoral Thank you. but it can not work. There are few java code in jsp (3 lines), just some el expression. but too many html(compressed) in it. Now I put the 3 lines java code to the head of jsp, it will ok.
    – xunitc
    Nov 11 at 2:38















up vote
0
down vote

favorite












My environment:
ubuntu 18.04
openjdk version "1.8.0_181"
tomcat 7.0.91



And I put these into WEB-INF/web.xml



<error-page>
<error-code>500</error-code>
<location>/500.html</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/500.html</location>
</error-page>


Now I write a test.jsp as:



<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<c:forEach begin="1" end="1000" step="1" var="i">
just test exception forward.
</c:forEach>
<%
Object o = null;
String s = o.toString();
%>
</body>
</html>


It will get an exception and goto /500.html. but it can not, when the exception, it just include the 500.html into current page.



I think the page is too large, if I put end="100" of c:forEach, it will forward 500.html.



How to fix this please?










share|improve this question




















  • 1




    You need to understand that at some point the servlet container (Tomcat) decides to actually start sending data over the wire (usually when an output buffer reaches some threshold). If anything happens after that point, there is nothing much a server can do to take back the data that has already been sent. docs.oracle.com/javaee/6/api/javax/servlet/…
    – Pavel Horal
    Nov 11 at 0:51












  • @PavelHoral Thank you. and is there a parameter to adjust buffer-size please?
    – xunitc
    Nov 11 at 0:57






  • 1




    I am not sure as I never needed to change such thing.... maybe socket.appWriteBufSize tomcat.apache.org/tomcat-8.5-doc/config/http.html . But I would say you just need to write your app in a different way... maybe don't write Java code into JSP as that is considered a bad practice.
    – Pavel Horal
    Nov 11 at 1:57












  • @PavelHoral Thank you. but it can not work. There are few java code in jsp (3 lines), just some el expression. but too many html(compressed) in it. Now I put the 3 lines java code to the head of jsp, it will ok.
    – xunitc
    Nov 11 at 2:38













up vote
0
down vote

favorite









up vote
0
down vote

favorite











My environment:
ubuntu 18.04
openjdk version "1.8.0_181"
tomcat 7.0.91



And I put these into WEB-INF/web.xml



<error-page>
<error-code>500</error-code>
<location>/500.html</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/500.html</location>
</error-page>


Now I write a test.jsp as:



<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<c:forEach begin="1" end="1000" step="1" var="i">
just test exception forward.
</c:forEach>
<%
Object o = null;
String s = o.toString();
%>
</body>
</html>


It will get an exception and goto /500.html. but it can not, when the exception, it just include the 500.html into current page.



I think the page is too large, if I put end="100" of c:forEach, it will forward 500.html.



How to fix this please?










share|improve this question















My environment:
ubuntu 18.04
openjdk version "1.8.0_181"
tomcat 7.0.91



And I put these into WEB-INF/web.xml



<error-page>
<error-code>500</error-code>
<location>/500.html</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/500.html</location>
</error-page>


Now I write a test.jsp as:



<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<c:forEach begin="1" end="1000" step="1" var="i">
just test exception forward.
</c:forEach>
<%
Object o = null;
String s = o.toString();
%>
</body>
</html>


It will get an exception and goto /500.html. but it can not, when the exception, it just include the 500.html into current page.



I think the page is too large, if I put end="100" of c:forEach, it will forward 500.html.



How to fix this please?







tomcat error-code






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 0:44

























asked Nov 11 at 0:39









xunitc

216




216








  • 1




    You need to understand that at some point the servlet container (Tomcat) decides to actually start sending data over the wire (usually when an output buffer reaches some threshold). If anything happens after that point, there is nothing much a server can do to take back the data that has already been sent. docs.oracle.com/javaee/6/api/javax/servlet/…
    – Pavel Horal
    Nov 11 at 0:51












  • @PavelHoral Thank you. and is there a parameter to adjust buffer-size please?
    – xunitc
    Nov 11 at 0:57






  • 1




    I am not sure as I never needed to change such thing.... maybe socket.appWriteBufSize tomcat.apache.org/tomcat-8.5-doc/config/http.html . But I would say you just need to write your app in a different way... maybe don't write Java code into JSP as that is considered a bad practice.
    – Pavel Horal
    Nov 11 at 1:57












  • @PavelHoral Thank you. but it can not work. There are few java code in jsp (3 lines), just some el expression. but too many html(compressed) in it. Now I put the 3 lines java code to the head of jsp, it will ok.
    – xunitc
    Nov 11 at 2:38














  • 1




    You need to understand that at some point the servlet container (Tomcat) decides to actually start sending data over the wire (usually when an output buffer reaches some threshold). If anything happens after that point, there is nothing much a server can do to take back the data that has already been sent. docs.oracle.com/javaee/6/api/javax/servlet/…
    – Pavel Horal
    Nov 11 at 0:51












  • @PavelHoral Thank you. and is there a parameter to adjust buffer-size please?
    – xunitc
    Nov 11 at 0:57






  • 1




    I am not sure as I never needed to change such thing.... maybe socket.appWriteBufSize tomcat.apache.org/tomcat-8.5-doc/config/http.html . But I would say you just need to write your app in a different way... maybe don't write Java code into JSP as that is considered a bad practice.
    – Pavel Horal
    Nov 11 at 1:57












  • @PavelHoral Thank you. but it can not work. There are few java code in jsp (3 lines), just some el expression. but too many html(compressed) in it. Now I put the 3 lines java code to the head of jsp, it will ok.
    – xunitc
    Nov 11 at 2:38








1




1




You need to understand that at some point the servlet container (Tomcat) decides to actually start sending data over the wire (usually when an output buffer reaches some threshold). If anything happens after that point, there is nothing much a server can do to take back the data that has already been sent. docs.oracle.com/javaee/6/api/javax/servlet/…
– Pavel Horal
Nov 11 at 0:51






You need to understand that at some point the servlet container (Tomcat) decides to actually start sending data over the wire (usually when an output buffer reaches some threshold). If anything happens after that point, there is nothing much a server can do to take back the data that has already been sent. docs.oracle.com/javaee/6/api/javax/servlet/…
– Pavel Horal
Nov 11 at 0:51














@PavelHoral Thank you. and is there a parameter to adjust buffer-size please?
– xunitc
Nov 11 at 0:57




@PavelHoral Thank you. and is there a parameter to adjust buffer-size please?
– xunitc
Nov 11 at 0:57




1




1




I am not sure as I never needed to change such thing.... maybe socket.appWriteBufSize tomcat.apache.org/tomcat-8.5-doc/config/http.html . But I would say you just need to write your app in a different way... maybe don't write Java code into JSP as that is considered a bad practice.
– Pavel Horal
Nov 11 at 1:57






I am not sure as I never needed to change such thing.... maybe socket.appWriteBufSize tomcat.apache.org/tomcat-8.5-doc/config/http.html . But I would say you just need to write your app in a different way... maybe don't write Java code into JSP as that is considered a bad practice.
– Pavel Horal
Nov 11 at 1:57














@PavelHoral Thank you. but it can not work. There are few java code in jsp (3 lines), just some el expression. but too many html(compressed) in it. Now I put the 3 lines java code to the head of jsp, it will ok.
– xunitc
Nov 11 at 2:38




@PavelHoral Thank you. but it can not work. There are few java code in jsp (3 lines), just some el expression. but too many html(compressed) in it. Now I put the 3 lines java code to the head of jsp, it will ok.
– xunitc
Nov 11 at 2:38

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244810%2ftomcat-can-not-forward-error-code-500-when-the-page-too-large%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244810%2ftomcat-can-not-forward-error-code-500-when-the-page-too-large%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine