Re: Error 500 with stack trace

Joseph Dane <[email protected]> Wed, 03 May 2006 09:33:14 -1000
Newsgroups gmane.text.xml.resin.user
Organization University of Hawaii
Message-ID <[email protected]>
Keith Fetterman <[email protected]> writes:

> a ServletException. When displaying the stack trace, the real cause is
> at the bottom, which is not printed. Instead, I see " ... 16 more".

Everything about the trace is printed.  The "16 more" thing just
shortens the display a bit.  It means "the next 16 frames that would
have been printed here are the same as the bottommost 16 frames of the
surrounding exception".

in your example, count up 16 frames from the bottom in the outer
exception (that is, the first one printed, the ServletException) and
you'll be 

  at com.marinersupply.servlet.actions.CheckOut.doAction(CheckOut.java:129)

which is where the ServletException was thrown.  the stack frames
below that (that is, the callers) are the same for these two
exceptions, so they aren't printed twice.

> Here is an example.

>
> javax.servlet.ServletException: Exception occurred during checkout
>          at
>          com.marinersupply.servlet.actions.CheckOut.doAction(CheckOut.java:129)
>          at com.marinersupply.servlet.Control.service(Control.java:177)
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
>          at
>          com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
>          at
>          com.marinersupply.common.servlet.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:37)
>          at
>          com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
>          at
>          com.marinersupply.common.servlet.HTTPSRedirectFilter.doFilter(HTTPSRedirectFilter.java:183)
>          at
>          com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
>          at
>          com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChain.java:135)
>          at
>          com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:175)
>          at
>          com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
>          at
>          com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208)
>          at
>          com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:396)
>          at com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
>          at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
>          at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
>          at java.lang.Thread.run(Thread.java:595)
> Caused by: java.lang.IllegalStateException: forward() not allowed
> after buffer has committed.
>          at
>          com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:139)
>          at
>          com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:106)
>          at
>          com.marinersupply.servlet.actions.CheckOut.doAction(CheckOut.java:127)
>          ... 16 more
>
> We are using Log4J.  Maybe there is a way to change the stack trace
> printing behavior?  I just now thought of that.  dah...
>
>
> Mattias Jiderhamn wrote:
>> This has caused us some trouble, since we have the error logging in
>> an "error servlet". Even if the error message cannot be shown in the
>> browser, we want the error to be logged.
>> At 2006-05-03 08:02, you wrote:
>>> Hi,
>>>  I've noticed that there's a difference on how Resin 3 handles
>>> errorpage-things compared to Resin 2. It seems that if there is an
>>> error in your JSP after something is already written to the
>>> response and its buffer has been committed, the errorpage cannot be
>>> shown anymore via the forward mechanism. This is propably what the
>>> spec expects, but Resin 2 didn't work like this...
>>>  -Kai
>>>
>>> ------------------------------------------------------------------------
>>> *From:* [email protected] [
>>> mailto:[email protected]] *On Behalf Of *Gary Wells
>>> *Sent:* 2. toukokuuta 2006 21:33
>>> *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(RequestDispatcherImpl.java:139)
>>>
>>> at
>>> com.caucho.server.webapp.RequestDispatcherImpl.error(RequestDispatcherImpl.java:113)
>>>
>>> at
>>> com.caucho.server.webapp.ErrorPageManager.sendServletError(ErrorPageManager.java:363)
>>>
>>> at
>>> com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:180)
>>>
>>> at
>>> com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java: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
>
>
>

-- 

joe