Tag Archives: Tomcat

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!