This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error-page element not working in web.xml

 
Rob Micah
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 1669
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic