运行时出错:java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener

时间:2014-01-27 12:48:38

标签: spring java-ee tomcat spring-mvc

我在SO中看过很多同样问题的帖子。但这些帖子中提供的解决方案无助于解决我的问题。

我创建了一个webapp并试图在tomcat服务器中运行它。当我尝试运行项目时,我得到HTTP状态404,并在tomcat控制台中出现以下错误:

Jan 27, 2014 6:02:40 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in   production environments was not found on the java.library.path: C:\Program   Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program  Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows \System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0_10\bin;.
Jan 27, 2014 6:02:40 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:EmployeeServices' did not find a matching property.
Jan 27, 2014 6:02:40 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:BataMeServices' did not find a matching property.
Jan 27, 2014 6:02:40 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 27, 2014 6:02:40 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 27, 2014 6:02:40 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 535 ms
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.33
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class   org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/EmployeeServices] startup failed due to previous errors
Jan 27, 2014 6:02:41 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO:  validateJarFile(D:\ielect_sw\ws_workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm p1\wtpwebapps\BataMeServices\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet  Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jan 27, 2014 6:02:43 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
log4j:ERROR setFile(null,true) call failed.

我已正确添加了spring的所有jar依赖项。任何解决上述问题的帮助都表示赞赏。

1 个答案:

答案 0 :(得分:2)