wood burning stoves 2.0*
The moose likes Servlets and the fly likes Error page configured in web.xml not working 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 » Java » Servlets
Bookmark "Error page configured in web.xml not working" Watch "Error page configured in web.xml not working" New topic
Author

Error page configured in web.xml not working

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
Hi,

I configured error pages in web.xml file with error codes and exception types.
This is my web.xml file




I intentionally renamed a file to get FileNotFoundException ,to invoke corresponding errorhandler.

I am getting a blank page with message:



OracleJSP: java.io.FileNotFoundException: (The system cannot find the file specified.
)

I am using Jdeveloper tool,OC4J Server,Struts application


Please guide me where iam making mistake.

Thanks & Regards,
Vipul Kumar.


Thanks
Vipul Kumar
vibhor sharma
Greenhorn

Joined: Dec 10, 2010
Posts: 19

Here is my guess :

You are using version 2.3 of web.xml file , which is not only rarely used now but also order of entries matters in version 2.3.

Check if you are using any JSP expression language , because version 2.3 doesn't support EL.

change your web.xml which could support at least version 2.4 , may be it could work for you.

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
Hi vibhor,

Thanks For your Reply.

You are using version 2.3 of web.xml file , which is not only rarely used now but also order of entries matters in version 2.3.


I have checked order of entries.They are perfectly matching with the specification.


Check if you are using any JSP expression language , because version 2.3 doesn't support EL.


Iam not using any EL.Jst simple jsp's and application is struts web application...
I cant change the version as it is preferred by the client,,....

If there is any other way ,please guide me....


Thanks & Regards
Vipul Kumar.

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
You are using version 2.3 of web.xml file , which is not only rarely used now but also order of entries matters in version 2.3.


Thanks Vibhor. Now configuration is working.order of entities is proper but a slight mistake in the positioning.
I don't know whethe it is the mistake or not.but when i change a little of my web.xml ,error pages are working.

May be this will be help full to other.I am posting the code what i have changed.

previous version of web.xml:-
<error-page>
<error-code>400</error-code>
<location>/errorhandler</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/errorhandler</location>
</error-page>
<error-page>
<error-code>500 </error-code>
<location>/errorhandler</location>
</error-page>

Above configuration did not work.


Current version of web.xml:-
<error-page>
<error-code>
400
</error-code>
<location>/errorhandler</location>
</error-page>
<error-page>
<error-code>
404
</error-code>
<location>/errorhandler</location>
</error-page>
<error-page>
<error-code>
500
</error-code>
<location>/errorhandler</location>
</error-page>

This configuration is working fine..

and one more remaining is exception-type tag..i kept java.lang.Throwable in exception-type tag in web.xml file.

This is not working.can any one having any suggestions for this .Any help is accepted...!


Thanks & Regards,
Vipul Kumar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error page configured in web.xml not working
 
Similar Threads
servlet action is not available
error comes while running the struts application please see the source code for detail
No grammar found web.xml
Parsing error processing resource path /WEB-INF/struts-config.xml
Failed to load servlet: