• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

app error page - no exception details.

 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to display the exception details on an application-wide error page as per HFS 460-461, by specifying it in the DD, but although I get the right page, the details of the exception are not being displayed.

If I set a page-specific error page, I get the exception details as expected, but not when the app defaults to the using the error page set in the DD.

Here's the jsp I am using to trigger the exception:

and the error page errorPage.jsp:


and in the DD I have the following:


and here's the output I get:
You caused a on the server.


Anyone else get this behaviour? Is it IE playing up again? Or have I missed some configuration setting somewhere?

 
Gabriel Forro
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Roger,

You can get info about the exception by:
${pageContext.errorData.throwable}

It works perfectly

Comment to the ${pageContext.exception} expression:

If you try:
<%= pageContext.getException() %>
instead of
${pageContext.exception}

you get 'null', so the problem is not in EL, but it can be in the implementation of pageContext object (instance of org.apache.jasper.runtime.PageContextImpl, if you use Tomcat).
I have tried it on Tomcat 5.0.28. Can it be a bug? I don't know. The Api doc is very short about this function
Can anybody comment that?
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gabriel,

Thanks for the info.
Another strange one, since the pageContext.exception is set and displays correctly when the page is invoked from a .jsp with "errorPage=...".
If you make a copy of the page and call it uniqueErrorPage.jsp" and add the following to the .jsp, then pageContext works as expected (as per HFS).


But when configured as the app default page, pageContext.exception doesn't get set, as your tests confirm.

I'm also using Tomcat 5.0.28, and am using Windows XP/I.E. 6.02
Are you using Windows/IE? If so, it could be another problem with I.E.!


If so, it may be worth Kathy changing the example in HFS to use your reference of pageContext.errordata.throwable, to make allowances for us poor Windows users, so we can follow the examples without hinderance!
 
Gabriel Forro
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roger,

thanx for the info about the explicitly set errorPage. Very strange. I am more confused know, as I don't know, whether it is a bug in Tomcat or a standard behaviour (as I said, the j2ee API is very laconic

I used an Eclipse built-in browser, but in my opinion this is a server-side thing, so the result is browser-independent. In my every-day life I use Mozilla Firefox browser. Try it! It's very nice and free.

I try to ask once more:
Can anybody help Roger and me on the pageContext.exception Tomcat behavior? Is it a bug or not? - that is the question
Please help, if You can!

Gabriel
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bug 31659 raised with Apache.

Here's what I logged:

Title: Page context not fully populated for Exception if using app-wide error page.

No exception is displayed when using the EL expression
${pageContext.exception} on an application-wide error page. (If using a
page-specific error page, the details are displayed correctly - even using a copy of the same page!).

EL *is* being evaluated since it is possible to display the exception
by using the following EL expression: ${pageContext.errorData.throwable}

Here's what I'm using:
In the DD:
<error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/nullErrorPage.jsp</location>
</error-page>

The error page nullErrorPage.jsp:
<%@ page isErrorPage="true"%>
<html><body>
You caused a NULL pointer exception! <br>
Exception type: ${pageContext.exception} <br>
Errordata: ${pageContext.errorData.throwable} <br>
</body></html>

and the request page:
<html><body>
Trying something naughty...: <br>
<% String s=null ; %>
<% int x=s.length() ; %>
</body></html>

By adding the line: <%@ page errorPage="/nullErrorPage.jsp" %>
to the request page, the exception details will be displayed correctly,
so something is happening (or rather not happening) for a DD-specified
error page.

Thanks Gabriel for pointing out that I could access the details with ${pageContext.errorData.throwable} - I've included that in the above bug report as you can see!

I'll keep you posted with the response!
[ October 11, 2004: Message edited by: Roger Yates ]
 
Gabriel Forro
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome
And thank You also!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic