Bug 56461 - New option to make context startup fail if a load-on-startup servlet fails
Summary: New option to make context startup fail if a load-on-startup servlet fails
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.53
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-26 21:05 UTC by Sylvain Laurent
Modified: 2014-05-19 20:45 UTC (History)
0 users



Attachments
Patch for tomcat 8 (10.39 KB, text/plain)
2014-04-26 21:05 UTC, Sylvain Laurent
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain Laurent 2014-04-26 21:05:46 UTC
Created attachment 31563 [details]
Patch for tomcat 8

Currently when a servlet with load-on-startup >=0 fails its startup, the context startup is still considered as OK.
With some webapps (like spring-based ones with a DispatcherServlet), this makes no sense at all : if the servlet failed its startup, the webapp is unuseable and it would be more sensible to have tomcat mark the context as failed.

Such a behavior is not specified in JEE specs, so I propose to have a new optional flag on Context and Host containers.

In the attached patch, the flag is named failDeploymentIfServletLoadedOnStartupFails . If specified on Context, it overrides the value potentially specified at the Host level.

The proposed patch for tomcat 8 passes checkstyle, provides a unit test and updates documentation.
If it's OK with the patch, I'd also like to have it backported to tomcat 7.
Comment 1 Mark Thomas 2014-04-26 21:11:43 UTC
It needs a shorter name.
Comment 2 Sylvain Laurent 2014-04-26 21:14:59 UTC
what about "failCtxIfServletStartFails" ?
Comment 3 Sylvain Laurent 2014-05-05 20:01:12 UTC
ping?
Comment 4 Sylvain Laurent 2014-05-18 21:19:39 UTC
committed r1595690 to tomcat 8 trunk, will be available in tomcat 8.0.9.
The new flag is named failCtxIfServletStartFails.
Comment 5 Sylvain Laurent 2014-05-19 20:45:56 UTC
merged to tomcat 7, will be availble in 7.0.55