Tomcat错误 - 失败 - 无法启动上下文路径/ petclinic中的应用程序

时间:2012-09-23 20:57:00

标签: java-ee tomcat

我已经浏览了类似的问题并且没有提出任何问题。我安装了Tomcat 7,然后使用maven编译了PetClinic应用程序。我成功地将它部署到了Tomcat。我已经取消部署并重新编译war文件并部署它,现在它抛出错误FAIL - 上下文路径/ petclinic中的应用程序无法启动。以下是日志文件的前几行。请指教。感谢。

    Sep 23, 2012 2:21:10 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Sep 23, 2012 2:21:10 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/log4j/LogManager$PrivateManager
    at org.apache.log4j.LogManager.getLogger(LogManager.java:34)
    at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:209)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
at org.springframework.web.context.ContextCleanupListener.<clinit>(ContextCleanupListener.java:43)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4831)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1255)
at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:714)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:219)

1 个答案:

答案 0 :(得分:0)

问题在于:

SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/log4j/LogManager$PrivateManager
    at org.apache.log4j.LogManager.getLogger(LogManager.java:34)
    at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:209)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)

问:您使用的是log4j(这是我推荐的)还是slf4j?

SUGGESTIONS:

1)确保相关的.jar文件(哎呀 - 为什么不包括 log4j和slf4j .jars)都在WAR的WEB-INF / lib文件夹中。

2)确保你的Tomcat环境中只有一个版本的log4j(可能你可能有两个相互矛盾的.jar版本)。