This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes error-page element not working in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "error-page element not working in web.xml" Watch "error-page element not working in web.xml" New topic
Author

error-page element not working in web.xml

Rob Micah
Ranch Hand

Joined: Aug 30, 2011
Posts: 94
I have an application deployed on an old version Oracle Application Server (10.1.2.3.0). I have an error-page element in my web.xml to point all java.lang.Exception's to an error page. But it's not working and I don't know why. Here is my web.xml. Can anyone see anything wrong with it?

Rob Micah
Ranch Hand

Joined: Aug 30, 2011
Posts: 94
It looks as though for some reason the app server does not like both the error-page element and the ejb-local-ref element to appear in the same file. If I take out the ejb-local-ref element then the error-page element functions correctly. Adding it back in causes it to not work once again. Is there something I'm missing here?
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
Your web.xml file is declared as using the Servlet 2.2 DTD.

ejb-local-ref was introduced with Servlet 2.3

What version of the Servlet spec does this Oracle Application Server support?

You can answer that question with this snippet of JSP:



If it is 2.3, you can change the DTD Definition of your web.xml file to:


If it is 2.2, then you can't use ejb-local-ref with this server.
Rob Micah
Ranch Hand

Joined: Aug 30, 2011
Posts: 94
Running that code in a jsp shows this:



Unfortunately changing my dtd to 2.3 still doesn't resolve the problem. Here's an example of one of my ejb-local-ref definitions:


I just don't see anything wrong with it. Do you?
Rob Micah
Ranch Hand

Joined: Aug 30, 2011
Posts: 94
I have figured out part of the problem. In my exception handler I was catching all exceptions and executing a sendError() on the response:


When I took that code out the error-page worked. However, using a error-code of 500 is not working and according to the documentation it should. In addition to that my error message in the sendError isn't appearing. Anything I'm missing?
Rob Micah
Ranch Hand

Joined: Aug 30, 2011
Posts: 94
Getting closer. When I change the error returned to 501 instead of 500 the error-page works. Is there some special configuration I could be missing?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error-page element not working in web.xml
 
Similar Threads
Listener started twice
web.xml
parse error with web-app when starting tomact
Problem in web.xml
Security in Websphere 5.1.2