我刚刚使用Spring模板为MVC创建的全新项目。我尝试在Server上运行并获得以下内容。
有什么想法吗?
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/src]]
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:618)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextException
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:87)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
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:5173)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
... 25 more
Jan 15, 2013 10:27:41 AM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor /Users/maratlevit/springsource/vfabric-tc-server-developer-2.7.2.RELEASE/base-instance/conf/Catalina/localhost/src.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/src]]
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:618)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
编辑:查看“标记”标签,我看到以下内容:
Description Resource Path Location Type
Archive for required library: '/Users/maratlevit/.m2/repository/org/springframework/spring-aop/3.1.1.RELEASE/spring-aop-3.1.1.RELEASE.jar' in project 'FirstLesson' cannot be read or is not a valid ZIP file FirstLesson Build path Build Path Problem
编辑2:根据要求添加了依赖项列表:
/Users/maratlevit/.m2/repository/org/springframework/spring-context/3.1.1.RELEASE/spring-context-3.1.1.RELEASE.jar
/Users/maratlevit/.m2/repository/org/springframework/spring-aop/3.1.1.RELEASE/spring-aop-3.1.1.RELEASE.jar
/Users/maratlevit/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
/Users/maratlevit/.m2/repository/org/springframework/spring-beans/3.1.1.RELEASE/spring-beans-3.1.1.RELEASE.jar
/Users/maratlevit/.m2/repository/org/springframework/spring-core/3.1.1.RELEASE/spring-core-3.1.1.RELEASE.jar
/Users/maratlevit/.m2/repository/org/springframework/spring-expression/3.1.1.RELEASE/spring-expression-3.1.1.RELEASE.jar
/Users/maratlevit/.m2/repository/org/springframework/spring-asm/3.1.1.RELEASE/spring-asm-3.1.1.RELEASE.jar
/Users/maratlevit/.m2/repository/org/springframework/spring-webmvc/3.1.1.RELEASE/spring-webmvc-3.1.1.RELEASE.jar
/Users/maratlevit/.m2/repository/org/springframework/spring-context-support/3.1.1.RELEASE/spring-context-support-3.1.1.RELEASE.jar
/Users/maratlevit/.m2/repository/org/springframework/spring-web/3.1.1.RELEASE/spring-web-3.1.1.RELEASE.jar
/Users/maratlevit/.m2/repository/org/aspectj/aspectjrt/1.6.10/aspectjrt-1.6.10.jar
/Users/maratlevit/.m2/repository/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.jar
/Users/maratlevit/.m2/repository/org/slf4j/jcl-over-slf4j/1.6.6/jcl-over-slf4j-1.6.6.jar
/Users/maratlevit/.m2/repository/org/slf4j/slf4j-log4j12/1.6.6/slf4j-log4j12-1.6.6.jar
/Users/maratlevit/.m2/repository/log4j/log4j/1.2.15/log4j-1.2.15.jar
/Users/maratlevit/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar
/Users/maratlevit/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
/Users/maratlevit/.m2/repository/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar
/Users/maratlevit/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar
/Users/maratlevit/.m2/repository/junit/junit/4.7/junit-4.7.jar
答案 0 :(得分:2)
我要检查的第一件事是:
项目 - >右键单击 - >属性 - > Java构建路径 - >图书馆 - >确保“Maven Dependencies”在该列表中。
第二次测试:
项目 - >右键单击 - >属性 - >部署组件 - >确保“Maven Dependencies”作为源列在该列表中。然后,确保与其对应的“部署路径”正确无误。我通常使用我的部署路径{project} / src / main / webapp / WEB-INF / lib
希望它有所帮助。
答案 1 :(得分:0)
需要更具体的信息:这是一个maven项目吗?是否所有罐子都加入了项目?
可能导致ClassNotFound
例外的因素:
Jars未添加到WEB-INF/lib
目录
在web.xml中未正确配置DispatcherServlet引用
你可以上传web.xml,spring xml,项目结构并验证上面的信息吗?
答案 2 :(得分:0)
您的类路径很可能已正确设置,这就是您获得ClassNotFoundException
。
检查它是否正确,并且所有的罐子都放在正确的位置。