title: Tomcat startup: Reporting success even if web application failed to deploy
body: <p>I'm developing a web service using:</p>
  
  <ul>
  <li>Tomcat 7.0.57</li>
  <li><a href="http://en.wikipedia.org/wiki/Spring_Framework" rel="nofollow">Spring</a> MVC 4.1.6</li>
  <li>Linux Fedora 20</li>
  </ul>
  
  <p>I deploy my web application by copying it as an expanded folder as the ROOT context folder. Everything works fine, <strong>but when the web application fails to deploy</strong> during Spring initialization for whatever reason (for example, connecting to a cache service at startup), <strong>Tomcat still report successful startup</strong> messages:</p>
  
  <pre><code>INFO: Deployment of web application directory /opt/apache-tomcat-7.0.57/webapps/myapp/webapps/ROOT has finished in 20,547 ms
  INFO: Server startup in 20591 ms
  </code></pre>
  
  <p>In the same logs I can see previously the exception stack trace so I realize this is failing:</p>
  
  <pre><code>INFO: Initializing Spring root WebApplicationContext
  Jul 20, 2015 9:22:19 AM org.apache.catalina.core.StandardContext listenerStart
  SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createTokenResource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: 
  ....
  Jul 20, 2015 9:22:19 AM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Error listenerStart
  SEVERE: Context [] startup failed due to previous errors
  </code></pre>
  
  <p>Then I wonder why Tomcat reports that both as deployment error and success. I've been taking a look at the implementation of Catalina <code>HostConfig#deployDirectory</code> and it seems to 'silently swallow' the exception.</p>
  
  <ol>
  <li>Is this the intended behaviour of Tomcat?</li>
  <li>Is there some deployment mode which I can force a Tomcat startup error if my ROOT application fails to deploy?</li>
  <li>Is this changed/work-arounded in some other version of Tomcat?</li>
  <li>Am I taking a bad deployment approach?</li>
  <li>Am I focusing wrong the whole thing?</li>
  </ol>
  
  <p>You can assume that this web application will be the only application running in my Tomcat server.</p>