RE: Error 500 with stack trace

"Stephen P. Bouzan" <[email protected]> Tue, 2 May 2006 12:21:19 -0700
Newsgroups gmane.text.xml.resin.user
Message-ID <[email protected]>
I define the custom error page in resin.conf:
 
<error-page><error-code>500</error-code><location>/errorpage500.jsp</loc
ation></error-page>
 
The errorpage500.jsp contains (this includes my own table layout):
 
<%@ page isErrorPage="true" %>
<HTML>
<HEAD>
<title>Error - 500</title>
</BODY>
<table>
<tr>
<td>Exception Class:</span></td>
<td><%= exception.getClass() %></span></td>
</tr>
<tr>
<td>Message:</span></td>
<td><%= exception.getMessage() %></span></td>
</tr>
</table>
</BODY>
</HTML>
 
to test it try this testerror.jsp:
 
<%@ page errorPage="errorpage500.jsp" %>
<HTML>
<HEAD><TITLE>Test Error Page</TITLE></HEAD>
<BODY>
<H2>Throw Exception!</H2>
<% String nullString = null; %>
<!-- Ooops -->
<% nullString.length(); %>
</BODY>
</HTML>

________________________________

From: [email protected]
[mailto:[email protected]] On Behalf Of Gary Wells
Sent: Tuesday, May 02, 2006 11:33 AM
To: [email protected]
Subject: RE: Error 500 with stack trace



To clarify my two questions further...

 

1) How do you get the custom error 500 page to display? I've got the
following in my web.xml:

 

<error-page>

    <error-code>500</error-code>

    <location>/500.jsp</location>

  </error-page>

 

... but when an 500 error is thrown I get the following error message:

 

java.lang.IllegalStateException: forward() not allowed after buffer has

committed.

at
com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcher
Impl.java:139)

at
com.caucho.server.webapp.RequestDispatcherImpl.error(RequestDispatcherIm
pl.java:113)

at
com.caucho.server.webapp.ErrorPageManager.sendServletError(ErrorPageMana
ger.java:363)

at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.ja
va:180)

at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.j
ava:229)

at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)

at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)

at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:492)

at com.caucho.util.ThreadPool.run(ThreadPool.java:425)

at java.lang.Thread.run(Thread.java:613)

 

 

2) How do you gain access to the stack trace of the original exception
so it can be displayed?

 

 

Thanks - G

 

________________________________

From: Gary Wells [mailto:[email protected]] 
Sent: Tuesday, May 02, 2006 10:51 AM
To: '[email protected]'
Subject: Error 500 with stack trace

 

Does anybody know how to setup Resin with a custom page for an error 500
that displays the stack trace?

 

Thanks - G