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?
tomcat error-code
add a comment |
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?
tomcat error-code
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.... maybesocket.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
add a comment |
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?
tomcat error-code
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
tomcat error-code
edited Nov 11 at 0:44
asked Nov 11 at 0:39
xunitc
266
266
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.... maybesocket.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
add a comment |
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.... maybesocket.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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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