You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by B D <bd...@gmail.com> on 2009/05/04 22:23:01 UTC

How to eliminate stack traces from Tomcat responses?

Hi,

I run a Spring web service application under Tomcat 5.5.25 and need to
eliminate stack traces from all error responses.

For Tomcat 3.2 you could add showDebugInfo="false" to server.conf but this
is not an option for 5.5.

Defining <error-page> in web.xml to handle all exceptions
(<exception-type>java.lang.Throwable</exception-type>) does not help. I am
not sure if that's related to the fact that exception is thrown before
request object is fully created and any of my code is actually called.

Any suggestions?

Any standard page with an error will do as long as it does not have any
stack trace info. Sample response with the stack trace and error log
snippets are below.

Thank you
B.D

Response with stack trace:
Submitted Data Too Large&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache
Tomcat/5.5.25 - Error report&lt;/title&gt;&lt;style&gt;&lt;!--H1
{font-family:Tahoma,Arial,s
ans-serif;color:white;background-color:#525D76;font-size:22px;} H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-col
or:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;fon
t-size:12px;}A {color : black;}A.name {color : black;}HR {color :
#525D76;}--&gt;&lt;/style&gt; &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status
500 - &lt;/h1&gt;
&lt;HR size=&quot;1&quot;
noshade=&quot;noshade&quot;&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Exception
report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt; &lt;u&gt
;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&gt; &lt;u&gt;The
server encountered an internal error () that prevented it from fulfilling
this request
.&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;exception&lt;/b&gt;
&lt;pre&gt;org.springframework.ws.soap.axiom.AxiomSoapMessageCreationException:
Could not parse reque
st: Strange I/O stream, returned 0 bytes on read; nested exception is
com.ctc.wstx.exc.WstxIOException: Strange I/O stream, returned 0 bytes on
read

 org.springframework.ws.soap.axiom.AxiomSoapMessageFactory.createWebServiceMessage(AxiomSoapMessageFactory.java:203)

 org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:86)

 org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:86)

 org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)

 org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)

 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)

 org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;note&lt;/b&gt; &lt;u&gt;The full
stack trace of the root cause is available in the Apache Tomcat/5.5.25
logs.&lt;/u&gt;&
lt;/p&gt;&lt;HR size=&quot;1&quot;
noshade=&quot;noshade&quot;&gt;&lt;h3&gt;Apache
Tomcat/5.5.25&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;
        {http://xml.apache.org/axis/}HttpErrorCode:413



I defined error handling page but it does not capture exception:
>From web.xml:
 <error-page>
   <exception-type>java.lang.Throwable</exception-type>
   <location>/error.jsp</location>
 </error-page>

>From logs:
SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Throwable,
location=/error.jsp]
org.springframework.web.util.NestedServletException: Request processing
failed; nested exception is
org.springframework.ws.soap.axiom.AxiomSoapMessageCreatio$
 at [row,col {unknown-source}]: [1,0]; nested exception is
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException:
Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
        at
org.springframework.web.servlet.FrameworkServlet.processRequest(Framework
Servlet.java:583)
        at
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
        at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
        at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
        at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
        at
org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:364)
        at
org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:213)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
        at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
        at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
        at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
        at java.lang.Thread.run(Thread.java:619)
Caused by:
org.springframework.ws.soap.axiom.AxiomSoapMessageCreationException: Could
not create message: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF i$
 at [row,col {unknown-source}]: [1,0]; nested exception is
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException:
Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
        at
org.springframework.ws.soap.axiom.AxiomSoapMessageFactory.createWebServiceMessage(AxiomSoapMessageFactory.java:206)
        at
org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:86)
        at
org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:86)
        at
org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
        at
org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
        at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
        ... 22 more
Caused by: org.apache.axiom.om.OMException:
com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
        at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
        at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:156)
        at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.identifySOAPVersion(StAXSOAPModelBuilder.java:128)
        at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:122)
        at
org.springframework.ws.soap.axiom.AxiomSoapMessageFactory.createAxiomSoapMessage(AxiomSoapMessageFactory.java:228)
        at
org.springframework.ws.soap.axiom.AxiomSoapMessageFactory.createWebServiceMessage(AxiomSoapMessageFactory.java:199)
        ... 27 more
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
        at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:661)
        at
com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134)
        at
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040)
        at
com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
        at
org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:506)
        at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:161)
        ... 32 more

Re: How to eliminate stack traces from Tomcat responses?

Posted by B D <bd...@gmail.com>.
Christopher,
You're right! It took me some time to get error.jsp coexist properly with
the web service but there are no more Tomcat/Spring traces in error
responses.

Thank you very much!


On Tue, May 5, 2009 at 11:56 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> B.D,
>
> On 5/4/2009 4:23 PM, B D wrote:
> > I run a Spring web service application under Tomcat 5.5.25 and need to
> > eliminate stack traces from all error responses.
> >
> > For Tomcat 3.2 you could add showDebugInfo="false" to server.conf but
> this
> > is not an option for 5.5.
> >
> > Defining <error-page> in web.xml to handle all exceptions
> > (<exception-type>java.lang.Throwable</exception-type>) does not help. I
> am
> > not sure if that's related to the fact that exception is thrown before
> > request object is fully created and any of my code is actually called.
>
> The request is fully created by the time Spring gets called, so you
> don't have to worry about anything weird like that.
>
> > From logs:
> > SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Throwable,
> > location=/error.jsp]
>
> I recommend fixing your error.jsp so that it doesn't throw its own
> exception: it looks like error.jsp itself is broken, to TC is
> falling-back on its own default error page.
>
> What do you get if you try to visit /error.jsp without an actual error
> occurring?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkoAYaEACgkQ9CaO5/Lv0PAn4gCfa3r/fis2hKG3MAizhUEJj1Du
> S4wAn0WXmyIEdp+7FziGtYQoBQ8FWNys
> =iW4J
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: How to eliminate stack traces from Tomcat responses?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

B.D,

On 5/4/2009 4:23 PM, B D wrote:
> I run a Spring web service application under Tomcat 5.5.25 and need to
> eliminate stack traces from all error responses.
> 
> For Tomcat 3.2 you could add showDebugInfo="false" to server.conf but this
> is not an option for 5.5.
> 
> Defining <error-page> in web.xml to handle all exceptions
> (<exception-type>java.lang.Throwable</exception-type>) does not help. I am
> not sure if that's related to the fact that exception is thrown before
> request object is fully created and any of my code is actually called.

The request is fully created by the time Spring gets called, so you
don't have to worry about anything weird like that.

> From logs:
> SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Throwable,
> location=/error.jsp]

I recommend fixing your error.jsp so that it doesn't throw its own
exception: it looks like error.jsp itself is broken, to TC is
falling-back on its own default error page.

What do you get if you try to visit /error.jsp without an actual error
occurring?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkoAYaEACgkQ9CaO5/Lv0PAn4gCfa3r/fis2hKG3MAizhUEJj1Du
S4wAn0WXmyIEdp+7FziGtYQoBQ8FWNys
=iW4J
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org