Sunday Sep 01

Key Concepts

JSF Error : Listener start error using Tomcat

PDFPrintE-mail
Monday, 06 June 2011 15:29
AddThis Social Bookmark Button

If you have a "Severe: Error ListenerStart" and you don't see the root cause you have another issue with your logging configuration. In this article we will compile the causes and the debugging methods to identify the root cause and solve the issue.

First of all when you have this issue you should have the following error in your log file or console :    

Jun 6, 2011 5:28:58 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart

Possible causes for a startup failed 

The following points will cause the deployment to fail.

  1. The listener in the web.xml file points to a class that doesn't exist. 
  2. The filter in the web.xml file points to a class that doesn't exist.
  3. The exception handler factory in the faces-config.xml points to a class that doesn't exist.
  4. The war file that you deploy does _NOT_ include a log4j.properties or log4j.xml file in the WEB-INF/classes folder - presumably because your webapp dynamically configures log4j in a different manner.

This list is not exhaustive. Feel free to help me to complete this list by posting a comment below. 

Root cause not logged 

It is quite obvious to fix the problem when you know the root cause but the  ClassNotFoundException thrown by most of the possible causes can be hidden. To fix this issue you have several possibilities : 

  1. Disable the logging properties defined in your webapp 
  2. Create a specific log configuration for your webapp

Disable the Logging properties defined in your webapp

Rename the logging.properties or log4j.properties files in your WEB-INF/Classes folder in your webapp

If your restart your application the default Tomcat logging contained in your Tomcat/conf folder should contain the stack trace of the failure

Create a specific log configuration for your webapp

In your Tomcat home folder open the logging.properties file located in the conf folder.

First of all create a new file handler called 5webapp.org.apache.juli.FileHandle and add it at the end of your handlers list. 

listener start error

handlers = java.util.logging.ConsoleHandler,\
    1catalina.org.apache.juli.FileHandler, \
    2localhost.org.apache.juli.FileHandler, \
    3manager.org.apache.juli.FileHandler, \
    4host-manager.org.apache.juli.FileHandler, \
    5webapp.org.apache.juli.FileHandler

Using the FileHandler properties we will define the file location, the level and the file prefix 
listener start error severe 

5webapp.org.apache.juli.FileHandler.level = FINE
5webapp.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
5webapp.org.apache.juli.FileHandler.prefix = webapp.

At this stage we will associate the newly created fileHandler with our webapp called MyWebApp and define the level to Fine to have a maximum of details

error listenerstart

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/MyWebApp].level = FINE
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/MyWebApp].handlers = 5webapp.org.apache.juli.FileHandler, \
      java.util.logging.ConsoleHandler 

If we restart the application we should be able to consult the new log file called webapp.2011.01.04.log with all details related to your specific webapp

If you have any remark or questions feel free to put a comment.If you enjoyed this tutorial and want to promote it don't hesitate to click on

Tags: logging, error, folder, webapp, file, root, points

Add comment


Security code
Refresh

Java Tutorial on Facebook