Spring Dispatcher Servlet Not Found Problem
I'm trying 开发者_Go百科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
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.
works well when I copied all springwebmvc jars and pasted in WEB-INF/lib folder.....
Check the deployment assembly from project properties. If maven dependecies is missing add that. Your deployment assembly should look like this
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.
You may need to copy the contents of dist/ of the spring downloads and the required linked packages to web-inf/lib then try start server again
Right click on project -> Properties -> Deployment Assembly -> Add ->Java Build path entries -> maven dependency -> Finesh.
精彩评论