Nicolas Richeton's blog

How to solve ‘Error listenerStart’ Error with Spring, Log4j and Tomcat

☕️ 1 min read

Working with Spring, Log4j and Tomcat, you may have faced the following error, which prevents your web application to start :

Logs in french :

org.apache.catalina.core.StandardContext start GRAVE: Error listenerStart
org.apache.catalina.core.StandardContext start GRAVE: Erreur de démarrage du contexte [/mywebapp] suite aux erreurs précédentes

Logs in english :

org.apache.catalina.core.StandardContext start SEVERE: Error listenerStart
org.apache.catalina.core.StandardContext start SEVERE: Context [/mywebapp] startup failed due to previous errors

This error seems to come without any additional logs. Webapp startup is interrupted but you can start the application from the tomcat manager successfully.

The explaination for our case are :

  • We are using 2 context listeners : org.springframework.web.util.Log4jConfigListener and org.springframework.web.context.ContextLoaderListener.
  • Log4jConfigListener automatically sets a SYSTEM property : webapp.root to share the application context
  • On Tomcat, system properties are system-wide, thus are shared between applications
  • If 2 applications are installed, the webapp.root value is invalid for the second one, causing the exception

Solution : define a unique webAppRootKey value for each application.


See : for additional information.

Note : Resin does not have this issue because it does not share system properties between webapps.