简体   繁体   English

在Tomcat 5.5中部署web-app时如何解决Error listenerStart?

[英]How to resolve Error listenerStart when deploying web-app in Tomcat 5.5?

I've deployed an Apache Wicket web-application that uses Spring and Hibernate to my Tomcat 5.5 instance. 我已经部署了一个Apache Wicket Web应用程序,它将Spring和Hibernate用于我的Tomcat 5.5实例。 When I navigate to the Tomcat Manager interface I see that the web-application I deployed is not running. 当我导航到Tomcat Manager界面时,我发现我部署的Web应用程序没有运行。 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: 我的catalina.log包含以下内容:

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: 摘自web.xml:

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

Any help is greatly appreciated. 任何帮助是极大的赞赏。

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/ 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. 在Tomcat 6或更高版本中,默认记录器是“java.util.logging”记录器而不是Log4J。 So if you are trying to add a “log4j.properties” file – this will NOT work. 因此,如果您尝试添加“log4j.properties”文件 - 这将无法正常工作。 The Java utils logger looks for a file called “logging.properties” as stated here: http://tomcat.apache.org/tomcat-6.0-doc/logging.html Java utils记录器查找名为“logging.properties”的文件,如下所述: 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. 因此,要获得调试详细信息,请在WAR的“/ WEB-INF / classes”文件夹下创建一个“logging.properties”文件,然后就可以了。

And now when you restart your Tomcat, you will see all of your debugging in it's full glory!!! 现在,当您重新启动Tomcat时,您将看到所有调试完全荣耀!

Sample logging.properties file: 示例logging.properties文件:

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler
/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 . 应该在任何特定的服务器库/WEB-INF/lib Leave them in the appserver's own library. 将它们留在appserver自己的库中。 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). 删除/WEB-INF/lib的所有特定于appserver的库(如果已放置其中任何一个,还可以在JRE/libJRE/lib/ext )。

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. 特定于appserver的库包含在webapp库中的一个常见原因是,启动者认为这是修复javax.servlet类不可解析的编译错误的正确方法。 Putting them in webapp's library is the wrong solution. 将它们放在webapp的库中是错误的解决方案。 You should reference them in the classpath during compilation, ie 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. 您应该在编译期间在类路径中引用它们,即javac -cp /path/to/server/lib/servlet.jar等等,或者如果您使用的是IDE,则应该将服务器集成到IDE中并将其关联与服务器的Web项目。 The IDE will then automatically take server-specific libraries in the classpath ( buildpath ) of the webapp project. 然后,IDE将自动在webapp项目的类路径( buildpath )中获取特定于服务器的库。

I encountered this error when the JDK that I compiled the app under was different from the tomcat JVM. 当我编译app的JDK与tomcat JVM不同时,我遇到了这个错误。 I verified that the Tomcat manager was running jvm 1.6.0 but the app was compiled under java 1.7.0. 我验证了Tomcat管理器运行的是jvm 1.6.0,但该应用程序是在java 1.7.0下编译的。

After upgrading Java and changing JAVA_HOME in our startup script (/etc/init.d/tomcat) the error went away. 升级Java并在我们的启动脚本(/etc/init.d/tomcat)中更改JAVA_HOME后,错误就消失了。

Answered provided by Tom Saleeba is very helpful. Tom Saleeba提供的回答非常有帮助。 Today I also struggled with the same error 今天我也遇到了同样的错误

Apr 28, 2015 7:53:27 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart 2015年4月28日下午7:53:27 org.apache.catalina.core.StandardContext startInternal SEVERE:错误listenerStart

I followed the suggestion and added the logging.properties file. 我按照建议并添加了logging.properties文件。 And below was my reason of failure: 以下是我失败的原因:

java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded java.lang.IllegalStateException:未扩展WAR文件时,无法设置Web应用程序根系统属性

The root cause of the issue was a listener (Log4jConfigListener) that I added into the web.xml. 问题的根本原因是我添加到web.xml中的监听器(Log4jConfigListener)。 And as per the link SEVERE: Exception org.springframework.web.util.Log4jConfigListener , this listener cannot be added within a WAR that is not expanded. 并且根据链接SEVERE:Exception org.springframework.web.util.Log4jConfigListener ,无法在未展开的WAR中添加此侦听器。

It may be helpful for someone to know that this was happening on OpenShift JBoss gear. 有人知道这是在OpenShift JBoss设备上发生的,这可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM