1

我很好地将 Tomcat 与 Eclipse 一起使用。现在我无法启动服务器。尝试启动时出现以下异常。事情进展顺利。我不知道有什么改变,但显然有什么改变了。

Apr 7, 2012 12:28:29 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester
    at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.<init>(DigesterFacesConfigUnmarshallerImpl.java:42)
    at org.apache.myfaces.config.FacesConfigurator.getUnmarshaller(FacesConfigurator.java:262)
    at org.apache.myfaces.config.FacesConfigurator.feedStandardConfig(FacesConfigurator.java:566)
    at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:487)
    at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:296)
    at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
    at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:118)
    at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:111)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.digester.Digester
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
    ... 18 more
Apr 7, 2012 12:28:29 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Apr 7, 2012 12:28:29 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/webApp_appNameT] startup failed due to previous errors
Apr 7, 2012 12:28:29 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:172)
    at org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:131)
    at org.apache.myfaces.webapp.AbstractFacesInitializer._dispatchApplicationEvent(AbstractFacesInitializer.java:239)
    at org.apache.myfaces.webapp.AbstractFacesInitializer.destroyFaces(AbstractFacesInitializer.java:273)
    at org.apache.myfaces.webapp.StartupServletContextListener.contextDestroyed(StartupServletContextListener.java:153)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5466)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Apr 7, 2012 12:28:29 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/webApp_appNameT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1d98a]) and a value of type [org.apache.myfaces.config.RuntimeConfig] (value [org.apache.myfaces.config.RuntimeConfig@1712651]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Apr 7, 2012 12:28:29 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/webApp_appNameT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@18aab40]) and a value of type [org.apache.myfaces.context.servlet.StartupFacesContextImpl] (value [org.apache.myfaces.context.servlet.StartupFacesContextImpl@f102d3]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Apr 7, 2012 12:28:29 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/webApp_appNameT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@f07355]) and a value of type [org.apache.myfaces.context.servlet.StartupFacesContextImpl] (value [org.apache.myfaces.context.servlet.StartupFacesContextImpl@23f1bb]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Apr 7, 2012 12:28:29 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Apr 7, 2012 12:28:29 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Apr 7, 2012 12:28:29 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1756 ms
4

2 回答 2

4

我有同样的问题。Eclipse 中的 Webapp 和 Tomcat 运行良好,然后 Eclipse 冻结;我不得不用 TaskManager 杀死它。但是,当我重新启动 tomcat 时,出现了上面的错误 java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester。

这没有意义,因为 webapp 之前运行良好。我通过清理 eclipse tomcat webapp 目录解决了这个问题。

  1. 转到 Servers 选项卡 -> 右键单击​​您的 webapp -> Clean Module 目录。
  2. 转到服务器选项卡 -> 右键单击​​使用的 Tomcat 实例 -> 清理...

之后错误消失了,webapp 又像以前一样运行了。

于 2012-09-20T13:54:10.713 回答
3
Caused by: java.lang.ClassNotFoundException: org.apache.commons.digester.Digester

这只是告诉您运行时类路径中缺少提到的类。正如包名所暗示的,它是 Apache Commons Digester,可在http://commons.apache.org/digester 获得。如果您下载 JAR 文件并将其放在 webapp 的运行时类路径所涵盖的路径之一中,例如/WEB-INF/lib,那么这个问题应该会消失。

于 2012-04-07T16:34:38.007 回答