Quick Tip – Tomcat silently fails when a Filter fails to start

I was throwing together a prototype to demonstrate some caching strategies but for some reason Tomcat was failing to start up cleanly. Annoyingly, the only error message was underwhelming.

SEVERE: Error filterStart
Jul 6, 2012 3:39:05 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors

There was obviously some bad config or setup but lets be honest, that’s a rubbish default message. The solution was to create a file called logging.properties and put it on the classpath: so either in WEB-INF/classes or list it directly on the classpath. Maven users can put it in src/main/resources. This file should contain the following config which will output the stacktrace of the offending error.

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler

This produces the more informative stacktrace below.

Jul 6, 2012 3:34:33 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter cacheFilter
java.lang.ClassNotFoundException: com.betfair.web.filters.CachingFilter
...
SEVERE: Error filterStart

In my case it was a simple misconfiguration of the project where I hadn’t included it, d’oh!

4 thoughts on “Quick Tip – Tomcat silently fails when a Filter fails to start

  1. anil

    Can you please show up the changes you have done.
    “In my case it was a simple misconfiguration of the project where I hadn’t included it, d’oh!”

    Reply
    1. anil

      Can you please show up the changes you have done.
      “In my case it was a simple misconfiguration of the project where I hadn’t included it, d’oh!”

      I am getting below erros:
      Feb 21, 2014 7:59:45 AM org.apache.catalina.core.StandardContext filterStart
      SEVERE: Exception starting filter noCacheFilter
      java.lang.ClassNotFoundException: com.hcl.NoCacheFilter
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:249)
      at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
      at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)
      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:448)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

      Feb 21, 2014 7:59:45 AM org.apache.catalina.core.StandardContext start
      SEVERE: Error filterStart
      Feb 21, 2014 7:59:45 AM org.apache.catalina.core.StandardContext start
      SEVERE: Context [/MUT] startup failed due to previous errors

      Reply
  2. sandeep

    HI,
    copy the jar file which contains the class “com.hcl.NoCacheFilter” in your project lib folder. I was facing the same type of problem . This is basically due to unavailability of jar files

    Reply
  3. Mauricio Carvalho

    Thanks for this article. Tomcat were wrapping a filter dependency error and I lose a lot of time debugging trying to discover it. Really Helpful.

    Thanks directly from São Paulo, Brazil 🙂

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *