Jan 13th, 2009, 07:12 PM
Show custom error page when tomcat fails to load the spring beans
I have a spring based application running on tomcat 5.x. I am using hibernate for Data access. My Database configuration is not right so when tomcat starts it throws up java.sql.SQLException, org.psotgressql.util.PSQLException,
java.net.NoRouteToHostException while trying to connect to the database and it keeps throwing these exceptions even when tomcat starts.
My Beans don't get loaded aswell. It hrows a BeanCreation Exception.
When I try to invoke the application through a url, it gives me the tomcat error with Http status 400 and says the requested resource is not available. Instead I want to customize this error page. I am able to invoke the application if the Database configuration info is right. I badly need to load up a page when the Database configuration is not right instead of showing the default tomcat error. I would appreciate any feedback.
Jan 15th, 2009, 01:08 AM
You can configure a seperate page for 400 errors in your web.xml. I don't think it's possible to get what caused the error and display a custom page based on that.