I'm trying to build a simple spring web application but I get the following error when I run it on Apache Tomcat 6.0
Class Not Found Exception org.springframework.web.servlet.DispatcherServlet
I'm using maven to handle libraries. At first I thought it was maven's fault but it adds spring and other libraries succesfully.
I tried to import "org.springframework.web.servlet.DispatcherServlet" in a source file and my project has the right package and classes.
My development environment :
Ubuntu 10.4 Eclipse IDE Tomcat 6.0
I'd appreciate any help
Make sure that your pom.xml is having compile time dependency like bellow
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>2.5.6</version>
<scope>compile</scope>
</dependency>
Once project is build unzip your war file see it has required dependencies packaged properly or not in WEB-INF/lib
当我复制所有springwebmvc罐并粘贴在WEB-INF / lib文件夹中时效果很好.....
I added external jars thru java build path which were not reflected in web-inf/lib folder.so,the error occured.
I copied all those jars and pasted in the web-inf/lib folder and then my prob got solved.
Hope it helps.
If you can't find that class in WEB-INF/lib, the classloader won't either. Believe the JVM and assume that you (or Maven) has packaged or deployed it incorrectly.
您可能需要将spring下载的dist /内容和所需的链接包复制到web-inf / lib,然后再次尝试启动服务器
右键单击项目 - > Properties - > Deployment Assembly - > Add - > Java Build path entries - > maven dependency - > Finesh。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.