Reputation: 253
Is there a way to configure Tomcat to die automatically if there's an error loading a web app (i.e. the app throws an exception), or if it can't find any apps at all? I'd rather my users get a connection problem than a blank white page.
Upvotes: 0
Views: 175
Reputation: 1108632
You could do
System.exit(-1);
instead of
throw SomeException("Failed to initialize webapp");
However, when you deploy this to a 3rd party or shared host which allows this, the serveradmin isn't going to be happy with this.
I'd rather review your model/view/controller logic so that the enduser get a (custom) HTTP 500 error page instead of a blank page. Are you sure you aren't writing Java code in JSP files? Throwing exceptions inside JSP files may namely cause this.
Upvotes: 1