Company

Debugging the dreaded "SEVERE: Error listenerStart" and "SEVERE: Error filterStart" tomcat error messages

March 18th, 2011 by
| Reply

Just a quick post that I hope might benefit others. If you have been developing web applications on tomcat for a while you have likely come the two error messages mentioned in the title.

SEVERE: Error listenerStart

Occurs when an exception is thrown in the contextInitialized method of a ServletContextListener

SEVERE: Error filterStart

Occurs when an exception is thrown in the init method of a Filter

Unfortunately by default, tomcat won't provide you with any details about the cause of the error. Infact it wont even tell you which filter or listener is failing. This can be big problem in applications of significant size that have many filters and 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

30 Responses

  1. 03-04-2011 at 21:29 by Flashrunner

    Thanks!
    It works!

  2. 19-04-2011 at 10:49 by Ali

    Brilliant solution!

  3. 28-04-2011 at 12:16 by Kevin Keegan

    You the man, top solution.

  4. 03-05-2011 at 08:50 by Racs

    Thanks, it works!

  5. 21-05-2011 at 13:28 by Micha Roon

    it just works. thanks a lot, it was driving me craizy this
    SEVERE: Error filterStart

  6. 07-06-2011 at 08:33 by Tseliso

    Thanks, it works!

  7. 21-06-2011 at 17:50 by Alex Guerrieri

    You saved me a lot of time with this little trick. Many thanks!

  8. [...] Debugging the dreaded “SEVERE: Error listenerStart” and “SEVERE: Error filterStart” tomcat e... (tags: java) Related: MacOS Forge und git... [...]

  9. 10-08-2011 at 22:22 by Bijesh

    Great help... Thanks alot

  10. 15-08-2011 at 20:23 by Niklas

    Be sure to really call the file "logging.properties". I was trying to add those lines to an existing "log4j.properties" file which did not produce the desired logging output (tomcat 7.0.19).
    Once I called the file "logging.properties" it worked...

  11. 24-08-2011 at 23:35 by Numerouno

    Thanks - it works

  12. 02-09-2011 at 08:21 by Amol

    Thx a lot it works..... Great Help :)

  13. 08-09-2011 at 11:22 by Marcel

    Hi,

    if you have this problem mit JBoss 4, then edit server/default/conf/jboss-log4j.xml and add this:

  14. 08-09-2011 at 11:23 by Marcel

    <category name="org.apache.catalina.core.ContainerBase">
    <priority value="INFO"/>
    </category>

  15. 12-12-2011 at 00:54 by Pravin

    Thanks a lot .....it worked!!

  16. 28-12-2011 at 08:18 by Roshan

    Thanks a lot dudde, It's solved my problem.
    Thanks once again.

  17. 11-01-2012 at 07:43 by Manav

    I did the steps. But still no stacktrace is printed on the console. Am I missing something ? Do I need to call logging.properties file explicitly ?

  18. 06-02-2012 at 17:05 by Gianluca

    Thanks! This saved my day once more!

  19. 09-02-2012 at 10:00 by Monali

    I had missed out on commons-pool-1.4.jar in my spring application.
    It works after I include this jar.

  20. 16-02-2012 at 18:30 by Steve

    I had SEVERE Error listenerStart while starting tomcat on Mac OS X lion and the fix for me was to set

    export JAVA_OPTS=-Djava.net.preferIPv4Stack=true

    before starting

  21. 03-03-2012 at 03:20 by Joselito

    thanks!

  22. 23-03-2012 at 03:34 by Thiago

    At Tomcat-7.0.x it only works if you set the configurations to conf/logging.properties

  23. 04-04-2012 at 18:34 by Kyle

    I'm using tomcat 7.0.12 and I can't get this to work. I added those lines to logging.properties in the conf directory but I still just get the same error with no extra information. Is there something else I need to do?

  24. 05-04-2012 at 20:58 by Maya Buttreeks

    Works perfectly! Thanks for the tip!

  25. 23-04-2012 at 00:32 by Jonathon

    Well, Thiago, fancy seeing you making that point, since I came here for that same reason.

    And...we work for the same company ;)

  26. 09-06-2012 at 10:53 by Semika

    Thank you so much. I can see full stack trance now. ;)

  27. 13-08-2012 at 08:46 by swetha

    Thank You so so much.Your tip is really useful.

  28. 28-11-2012 at 13:25 by dlaro

    Tomcat 7.0.30 provides such a standard logging configuration:

    ---
    org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
    org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler

    org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
    org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler

    org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
    org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler

    ---
    This means that you simply have o look into the parallel produced log file, which starts like "localhost.*".

  29. 22-01-2013 at 12:39 by Srikanth

    Thanks... it works

  30. 18-04-2013 at 13:10 by Arun Chaudhary

    Great help. Thanx a lot. It saved a lot of time.

Leave a Reply