| Author |
Problem when get all the exception stacktrace
|
Haifeng Jiang
Ranch Hand
Joined: Dec 14, 2008
Posts: 40
|
|
I can get all the exception stacktrace by using below method. but it only can display the stacktrace on the console.
results:
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O *************
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O com.ibm.ws.webcontainer.webapp.WebAppErrorReport:
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.webcontainer.servlet.ServletWrapper.constructErrorReport(ServletWrapper.java:789)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:694)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3444)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O Caused by: javax.servlet.ServletException
at com.ibm.partnerworld.incentives.management.RequestProcessor.processException(RequestProcessor.java)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
at com.ibm.partnerworld.incentives.management.RequestProcessor.processActionPerform(RequestProcessor.java:114)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at com.ibm.partnerworld.incentives.management.RequestProcessor.process(RequestProcessor.java:205)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1096)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3444)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
---- Begin backtrace for Nested Throwables
java.lang.NullPointerException
at com.ibm.partnerworld.incentives.management.action.PaymentRegister.execute(PaymentRegister.java)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at com.ibm.partnerworld.incentives.management.RequestProcessor.processActionPerform(RequestProcessor.java:114)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at com.ibm.partnerworld.incentives.management.RequestProcessor.process(RequestProcessor.java:205)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1096)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3444)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.partnerworld.incentives.management.RequestProcessor.processException(RequestProcessor.java)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.partnerworld.incentives.management.RequestProcessor.processActionPerform(RequestProcessor.java:114)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.partnerworld.incentives.management.RequestProcessor.process(RequestProcessor.java:205)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1096)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O ... 17 more
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O *************
when I use this method, I cannot get all exception stacktrace.
result:
[4/8/09 16:40:09:125 CST] 00000038 SystemOut O 22222222222222com.ibm.ws.webcontainer.webapp.WebAppErrorReport:
at com.ibm.ws.webcontainer.servlet.ServletWrapper.constructErrorReport(ServletWrapper.java:789)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:694)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3444)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Caused by: javax.servlet.ServletException
at com.ibm.partnerworld.incentives.management.RequestProcessor.processException(RequestProcessor.java)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
at com.ibm.partnerworld.incentives.management.RequestProcessor.processActionPerform(RequestProcessor.java:114)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at com.ibm.partnerworld.incentives.management.RequestProcessor.process(RequestProcessor.java:205)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1096)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)
... 17 more
3333333333
Why I get different result?
I just want to put all the exception stacktrace into a String object and display on the web page. So how can I get it? Any advice? Thanks.
|
Thinking a lot. Gaining a lot.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32644
|
|
Is it wise to put the stack trace on a website? The users will never understand it.
How about Throwable#getStackTrace()?
|
 |
Haifeng Jiang
Ranch Hand
Joined: Dec 14, 2008
Posts: 40
|
|
Campbell Ritchie wrote:Is it wise to put the stack trace on a website? The users will never understand it.
How about Throwable#getStackTrace()?
Thanks for your response.
But if I use getStackTrace method I cannot get the deep exception. For example. I get NullpointerException in A class. I throw it out. Then B class catch it and wrap it to ServletException(or other exception). Then in C class I catch it and want to get all the exception stacktrace. In this case I can only get the ServletException. But cannot get all the NullpointerException stacktrace. Any advice?
>
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32644
|
|
|
Are the classes throwing the exceptions "chained"? If so, you should be able to use getCause().
|
 |
Haifeng Jiang
Ranch Hand
Joined: Dec 14, 2008
Posts: 40
|
|
Campbell Ritchie wrote:Are the classes throwing the exceptions "chained"? If so, you should be able to use getCause().
I got one solution. just set the original exception stacktrace to the new exception stacktrace as below.
|
 |
Haifeng Jiang
Ranch Hand
Joined: Dec 14, 2008
Posts: 40
|
|
Haifeng Jiang wrote:
Campbell Ritchie wrote:Are the classes throwing the exceptions "chained"? If so, you should be able to use getCause().
I got one solution. just set the original exception stacktrace to the new exception stacktrace as below.
But I cannot get the original exception name by using the solution,
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14670
|
|
|
Check this article.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Haifeng Jiang
Ranch Hand
Joined: Dec 14, 2008
Posts: 40
|
|
Thanks so much! It is very helpful
Now I use below code when catched the exception.
and get the full stacktrace by using below code.
OK, thanks all again!
|
 |
 |
|
|
subject: Problem when get all the exception stacktrace
|
|
|