JSF Error : Listener start error using Tomcat
Last Updated on Tuesday, 02 April 2013 08:02
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 :
Possible causes for a startup failed
The following points will cause the deployment to fail.
- The listener in the web.xml file points to a class that doesn't exist.
- The filter in the web.xml file points to a class that doesn't exist.
- The exception handler factory in the faces-config.xml points to a class that doesn't exist.
- 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 :
- Disable the logging properties defined in your webapp
- 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.
Using the FileHandler properties we will define the file location, the level and the file prefix
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
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