title: Graceful degradation of servlets in Jetty
body: <p>I'm running an embedded Jetty 8 server that loads a few *.war files at startup:</p>
  
  <pre><code>for (File aWebAppDirectory : aWebAppDirectories) {
        if (aWebAppDirectory.exists() &amp;&amp; aWebAppDirectory.isDirectory()) {
          for (File warFile : aWebAppDirectory.listFiles(new WarFileFilter())) {            String basename = warFile.getName().replaceFirst("\\.war$", "");
           fHandlers.addHandler(new WebAppContext(warFile.getAbsolutePath(), "/" + basename));
         }
       }
     }
  </code></pre>
  
  <p>These war-files have some dependencies on a few classes that may or may not exist in the classpath.</p>
  
  <p>Right now if one of my servlets is missing a dependency, my entire embedded Jetty service fails. (Because of NoClassDefFoundExceptions)</p>
  
  <p>I need a method that allows me to catch exceptions for failing servlets and simply doesn't activate them. I'm looking for the same thing that TomCat does when a servlet fails to load: It still loads the rest.</p>
  
  <p>I haven't found any solutions after some time searching on Google.</p>
  
  <p>Anyone know how I can tackle this problem using embedded Jetty 8?</p>