1

我有一个工作的 spring 项目并将框架更新到版本 3.2.2。现在我可以构建我的项目,但我不能再部署它了。Aparently Tomcat 找不到负责日志记录的类。但是 springframework 在我的 CLASSPATH 中,我确信它也包含在 WAR 中。我误解了tomcat日志吗?

我什至开始了一个新的简约春季项目——同样的结果。

我被困在这里 - 任何帮助表示赞赏。

这是我的 Netbeans 日志:

Tomcat server started.
Incrementally deploying http://localhost:8080/SpringTest
Completed incremental distribution of http://localhost:8080/SpringTest
Incrementally redeploying http://localhost:8080/SpringTest
Deploy is in progress...
deploy?config=file%3A%2Ftmp%2Fcontext9144781847406895845.xml&path=/SpringTest
FAIL - Deployed application at context path /SpringTest but context failed to start
/home/maex/NetBeansProjects/SpringTest/nbproject/build-impl.xml:1061: The module has  not been deployed.
See the server log for details.
BUILD FAILED (total time: 7 seconds)

还有更有趣的 Tomcat Apache 日志:

INFO: Starting Servlet Engine: Apache Tomcat/7.0.40
Jun 01, 2013 7:00:05 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /home/maex/public_html/conf/Catalina/localhost/Bonjour.xml
Jun 01, 2013 7:00:05 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/maex/NetBeansProjects/Bonjour/build/web/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jun 01, 2013 7:00:07 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Bonjour]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2317)
    at java.lang.Class.getDeclaredFields(Class.java:1762)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    ... 25 more

Jun 01, 2013 7:00:07 PM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor /home/maex/public_html/conf/Catalina/localhost/Bonjour.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Bonjour]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
4

1 回答 1

2

看起来您有几个问题,但让我们从两个明显的问题开始。

INFO: validateJarFile(/home/maex/NetBeansProjects/Bonjour/build/web/WEB-INF/lib/servlet-api.jar) - jar not loaded...

此错误是由于在您的运行时中包含 servlet*.jar 引起的,它只需要在构建期间可用。servlet 容器(例如 tomcat)应该在运行时为您提供 servlet*.jar。

Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log;

您可能缺少公共日志记录 jar。在 webapp/WEB-INF/lib 或容器 lib 中使其可用。

于 2013-06-01T21:56:13.977 回答