views:

49

answers:

1

When the application is loading on a EAR re-deployment you get a 404 error, how do we trap this issue and provide a user friendly message to the end user accessing the application.

HTTP Status 404 - /myapp

type Status report

message /myapp

description The requested resource (/myapp) is not available.

JBoss Web/2.1.3.GA

+3  A: 

It wont be possible to give a friendly message from within the application - since the application /myapp itself is not available.

The usual way to handle this is at the web server level - where you set up another temporary site when your application is out due to maintenance. Redirect all requests to a friendly error message. No requests will come through to the app server. Any bookmarked URLs will also get the out of service page from the alternate app. A detailed approach is given at http://www.webreference.com/programming/Apache-Site-Down-Notice/

If you do not have a web server in your setup, then you can set up the maintenance page (some index.html) on another web app setup with the same context mapping to /myapp When your EAR is down, bring up that one.

For JBoss I think you can change the location of the 404 page by setting it in

server/xxx/deployers/jbosssweb.deployer/web.xml

You'll have to make this point to some page OUTSIDE of /myapp

JoseK
Great post. I was just looking for a resource that explained how to do contingency pages. Thanks!
Shadowman