File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Cannot get to the error page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Cannot get to the error page" Watch "Cannot get to the error page" New topic

Cannot get to the error page

John Dell'Oso
Ranch Hand

Joined: Apr 08, 2004
Posts: 130
Howdy there,

I've recently installed Tomcat 5.0.25. I am having problems directing a jsp page to an error page. This worked fine with Tomcat 4.0. I end up getting an HTTP 500 Internal Server error. Here's the code:

### File - errorTesting.jsp

<%@ page errorPage="errPage.jsp" %>
<title>Simple Error Testing</title>

<%! String nullString = null; %>

<%-- Intentionally invoking a NullPointerException --%>
The length of the nullString is <%= nullString.length() %>

##### File - errPage.jsp

<%@ page isErrorPage="true" %>

<h2>Uncaught exception <%= exception %> has been encountered!</h2>


As you can see there is no rocket science here. But I cannot get the error page to show. I just keep getting the IE "This page cannot be displayed" message. If I change the value of the nullString variable to an actual string value, the JSP page works fine. As soon as I change it back to null in an attempt to throw an exception and forward through to the error page it all blows up.

Both JSPs are in the same directory. I have checked the work directory under Tomcat and the java code looks fine and the .class file is created as well.

Any ideas as to what is going on here? As I mentioned earlier on my post, this code works on another machine where I'm running Tomcat 4.1.18.

[ July 15, 2004: Message edited by: Wayne Carey ]
John Dell'Oso
Ranch Hand

Joined: Apr 08, 2004
Posts: 130
Well here's the answer .. seems to be a typical Microsoft thing with IE. The work around (fix) to this problem is to turn off the "Show friendly HTTP error messages" option in IE. Navigate to Tools -> Internet Options -> Advanced -> Browsing.

The Duck
Pedro Penna
Ranch Hand

Joined: Jun 05, 2004
Posts: 46
Try changing the errorPage path to /errPage.jsp, like this:

[ July 16, 2004: Message edited by: Pedro Penna ]
I agree. Here's the link:
subject: Cannot get to the error page
It's not a secret anymore!