How to resolve Error listenerStart when deploying web-app in Tomcat 5.5?
Asked Answered
G

4

40

I've deployed an Apache Wicket web-application that uses Spring and Hibernate to my Tomcat 5.5 instance. When I navigate to the Tomcat Manager interface I see that the web-application I deployed is not running. When I press 'Start' I get the following error message; "FAIL - Application at context path /spaghetti could not be started".

My catalina.log contains the following:

Apr 15, 2010 1:51:22 AM org.apache.catalina.loader.WebappClassLoader validateJarFile  
INFO: validateJarFile(/var/lib/tomcat5.5/webapps/spaghetti/WEB-INF/lib/jsp-api-6.0.16.jar)   - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/jsp/JspPage.class  
Apr 15, 2010 1:51:22 AM org.apache.catalina.loader.WebappClassLoader validateJarFile  
INFO: validateJarFile(/var/lib/tomcat5.5/webapps/spaghetti/WEB-INF/lib/servlet-api-6.0.16.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class  
Apr 15, 2010 1:51:24 AM org.apache.catalina.core.StandardContext start  
SEVERE: Error listenerStart  
Apr 15, 2010 1:51:24 AM org.apache.catalina.core.StandardContext start  
SEVERE: Context [/spaghetti] startup failed due to previous errors

Excerpt from web.xml:

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

Any help is greatly appreciated.

Gearbox answered 14/4, 2010 at 21:55 Comment(1)
Look at this: blog.trifork.com/2011/03/18/…Thomson
E
35
/var/lib/tomcat5.5/webapps/spaghetti/WEB-INF/lib/jsp-api-6.0.16.jar
/var/lib/tomcat5.5/webapps/spaghetti/WEB-INF/lib/servlet-api-6.0.16.jar

You should not have any server-specific libraries in the /WEB-INF/lib. Leave them in the appserver's own library. It would only lead to collisions in the classpath. Get rid of all appserver-specific libraries in /WEB-INF/lib (and also in JRE/lib and JRE/lib/ext if you have placed any of them there).

A common cause that the appserver-specific libraries are included in the webapp's library is that starters think that it is the right way to fix compilation errors of among others the javax.servlet classes not being resolveable. Putting them in webapp's library is the wrong solution. You should reference them in the classpath during compilation, i.e. javac -cp /path/to/server/lib/servlet.jar and so on, or if you're using an IDE, you should integrate the server in the IDE and associate the web project with the server. The IDE will then automatically take server-specific libraries in the classpath (buildpath) of the webapp project.

Endosperm answered 14/4, 2010 at 22:6 Comment(2)
Thanks for the help BalusC. I haven't explicitly added the servlet-api or jsp-api to the dependencies list in my pom.xml, actually they're not listed there. Perhaps it's a dependency of one of the dependencies I have. I'll give your suggestion a go.Gearbox
I had a similar issue, in WTP within Eclipse, in /workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/... It started after upgrading from Servlet 2.5 to 3.0, so I figured a right-click on the server, and then "Clean Tomcat Work Directory" should wipe it. But things kept coming back. Eventually, mvn dependency:tree showed that some dependencies were including both javax.servlet:servlet-api:jar:2.5 and org.mortbay.jetty:servlet-api:jar:2.5-20081211.Prognosticate
A
72

I found that following these instructions helped with finding what the problem was. For me, that was the killer, not knowing what was broken.

http://mythinkpond.wordpress.com/2011/07/01/tomcat-6-infamous-severe-error-listenerstart-message-how-to-debug-this-error/

Quoting from the link

In Tomcat 6 or above, the default logger is the”java.util.logging” logger and not Log4J. So if you are trying to add a “log4j.properties” file – this will NOT work. The Java utils logger looks for a file called “logging.properties” as stated here: http://tomcat.apache.org/tomcat-6.0-doc/logging.html

So to get to the debugging details create a “logging.properties” file under your”/WEB-INF/classes” folder of your WAR and you’re all set.

And now when you restart your Tomcat, you will see all of your debugging in it’s full glory!!!

Sample logging.properties file:

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler
Arbitrament answered 24/1, 2013 at 5:10 Comment(3)
Thanks! Exactly what you've said and magically we can check the real cause of the problem and stop wasting time. :-) Cheers.Danielladanielle
This is only part of the(/my) problem. The listenerStart-error occured in catalina.out while the stacktrace was written to localhost-<date>.out. So be sure to check all of tomcat's log files for stacktraces (possibly by finding out the pid using ps aux | grep tomcat and finding out tomcat's open files using lsof -p <pid>)Dora
The link is no longer active.Hawsehole
E
35
/var/lib/tomcat5.5/webapps/spaghetti/WEB-INF/lib/jsp-api-6.0.16.jar
/var/lib/tomcat5.5/webapps/spaghetti/WEB-INF/lib/servlet-api-6.0.16.jar

You should not have any server-specific libraries in the /WEB-INF/lib. Leave them in the appserver's own library. It would only lead to collisions in the classpath. Get rid of all appserver-specific libraries in /WEB-INF/lib (and also in JRE/lib and JRE/lib/ext if you have placed any of them there).

A common cause that the appserver-specific libraries are included in the webapp's library is that starters think that it is the right way to fix compilation errors of among others the javax.servlet classes not being resolveable. Putting them in webapp's library is the wrong solution. You should reference them in the classpath during compilation, i.e. javac -cp /path/to/server/lib/servlet.jar and so on, or if you're using an IDE, you should integrate the server in the IDE and associate the web project with the server. The IDE will then automatically take server-specific libraries in the classpath (buildpath) of the webapp project.

Endosperm answered 14/4, 2010 at 22:6 Comment(2)
Thanks for the help BalusC. I haven't explicitly added the servlet-api or jsp-api to the dependencies list in my pom.xml, actually they're not listed there. Perhaps it's a dependency of one of the dependencies I have. I'll give your suggestion a go.Gearbox
I had a similar issue, in WTP within Eclipse, in /workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/... It started after upgrading from Servlet 2.5 to 3.0, so I figured a right-click on the server, and then "Clean Tomcat Work Directory" should wipe it. But things kept coming back. Eventually, mvn dependency:tree showed that some dependencies were including both javax.servlet:servlet-api:jar:2.5 and org.mortbay.jetty:servlet-api:jar:2.5-20081211.Prognosticate
M
10

I encountered this error when the JDK that I compiled the app under was different from the tomcat JVM. I verified that the Tomcat manager was running jvm 1.6.0 but the app was compiled under java 1.7.0.

After upgrading Java and changing JAVA_HOME in our startup script (/etc/init.d/tomcat) the error went away.

Molding answered 29/12, 2014 at 17:45 Comment(1)
That was my problem exactly, thanks for this solutionNitramine
M
2

Answered provided by Tom Saleeba is very helpful. Today I also struggled with the same error

Apr 28, 2015 7:53:27 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart

I followed the suggestion and added the logging.properties file. And below was my reason of failure:

java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded

The root cause of the issue was a listener (Log4jConfigListener) that I added into the web.xml. And as per the link SEVERE: Exception org.springframework.web.util.Log4jConfigListener , this listener cannot be added within a WAR that is not expanded.

It may be helpful for someone to know that this was happening on OpenShift JBoss gear.

Mamiemamma answered 29/4, 2015 at 0:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.