我在我的项目中遇到了一些问题,这是一个 Spring MVC 项目。在这个项目中,对于持久层,我们使用的是 Hibernate。
以下是我的web.xml
详细信息:
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/beanRefFactory.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
当我尝试运行此项目时,出现以下错误:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:525)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:507)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:124)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
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)
这是我的类路径 jar 详细信息:
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/ant-1.6.5.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/ant-antlr-1.6.5.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/antlr-2.7.6.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/aopalliance-1.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/asm-attrs.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/asm.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/aspectjweaver-1.6.9.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/c3p0-0.9.1.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/c3p0-0.9.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/cglib-2.1.3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/cglib-2.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/cglib-nodep-2.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-collections-3.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-dbcp-1.4.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/commons-pool-1.5.3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/ehcache-1.2.3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/ejb3-persistence.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-annotations.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-commons-annotations.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-entitymanager.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-search.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate-validator.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/hibernate3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/javassist-3.9.0.GA.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/jta-1.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/jta.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/lucene-core-2.3.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/hibernate/oscache-2.4.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/antlr-runtime-3.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/commons-beanutils-1.8.3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/commons-configuration-1.4.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/commons-logging-1.0.4.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/jstl.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/log4j-1.2.16.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.asm-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.beans-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.context-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.context.support-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.core-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.expression-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.jdbc-3.1.1.RELEASE.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.transaction-3.1.1.RELEASE.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.web-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/org.springframework.web.servlet-3.0.0.M3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/slf4j-api-1.6.6.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/slf4j-log4j12-1.6.6.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/spring-orm-3.2.0.M1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/spring-oxm-3.2.0.M1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/spring/standard.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/misslenious/mysql-connector-java-5.1.8-bin.jar"/>
任何指针或帮助都是非常可观的。提前致谢。