在 Tomcat 5.5 中部署 web-app 时如何解决 Error listenerStart? [英] How to resolve Error listenerStart when deploying web-app in Tomcat 5.5?

查看:14
本文介绍了在 Tomcat 5.5 中部署 web-app 时如何解决 Error listenerStart?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将使用 Spring 和 Hibernate 的 Apache Wicket Web 应用程序部署到我的 Tomcat 5.5 实例.当我导航到 Tomcat 管理器界面时,我看到我部署的 Web 应用程序没有运行.当我按开始"时,我收到以下错误消息;失败 - 上下文路径/spaghetti 上的应用程序无法启动".

我的 catalina.log 包含以下内容:

2010 年 4 月 15 日上午 1:51:22 org.apache.catalina.loader.WebappClassLoader validateJarFile信息:validateJarFile(/var/lib/tomcat5.5/webapps/spaghetti/WEB-INF/lib/jsp-api-6.0.16.jar) - jar 未加载.请参阅 Servlet 规范 2.3,第 9.7.2 节.违规类:javax/servlet/jsp/JspPage.class2010 年 4 月 15 日上午 1:51:22 org.apache.catalina.loader.WebappClassLoader validateJarFile信息:validateJarFile(/var/lib/tomcat5.5/webapps/spaghetti/WEB-INF/lib/servlet-api-6.0.16.jar) - jar 未加载.请参阅 Servlet 规范 2.3,第 9.7.2 节.违规类:javax/servlet/Servlet.class2010 年 4 月 15 日上午 1:51:24 org.apache.catalina.core.StandardContext 开始严重:错误 listenerStart2010 年 4 月 15 日上午 1:51:24 org.apache.catalina.core.StandardContext 开始严重:由于先前的错误,上下文 [/spaghetti] 启动失败

摘自 web.xml:

<前><听众><听众类>org.springframework.web.context.ContextLoaderListener</listener-class>

非常感谢任何帮助.

解决方案

/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

您应该不要/WEB-INF/lib 中有任何特定于服务器的库.将它们留在应用程序服务器自己的库中.它只会导致类路径中的冲突.删除 /WEB-INF/lib(以及 JRE/libJRE/lib/ext 中的所有特定于应用程序服务器的库,如果你已经把它们中的任何一个放在那里).

将特定于应用程序服务器的库包含在 web 应用程序的库中的一个常见原因是,初学者认为这是修复无法解析的 javax.servlet 类等编译错误的正确方法.将它们放在 webapp 的库中是错误的解决方案.您应该在编译期间在类路径中引用它们,即 javac -cp/path/to/server/lib/servlet.jar 等等,或者如果您使用的是 IDE,则应该集成IDE 中的服务器并将 Web 项目与服务器相关联.然后,IDE 将自动在 webapp 项目的类路径 (buildpath) 中获取特定于服务器的库.

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.

解决方案

/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.

这篇关于在 Tomcat 5.5 中部署 web-app 时如何解决 Error listenerStart?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆