Wednesday, May 28, 2014

Debugging the tomcat startup error messages - "SEVERE: Error listenerStart"

Today I was trying to deploy one of my web applications in the test server, tomcat was simply throwing this exception:

SEVERE: Error listenerStart

This exception occurs when an exception is thrown in the contextInitialized method of a ServletContextListener. Unfortunately by default, tomcat won't provide you with any details about the cause of the error. Infact it wont even tell you which listener is failing. This can be big problem in applications of significant size that have many listeners configured. Fortunately there is a solution. In your webapplication's WEB-INF/classes folder you can create a logging.properties file with the following contents

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


Now you will be presented with the stacktrace