views:

143

answers:

3

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

+1  A: 

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.

duffymo
doesnt maven automatically do that library deploying for me? If it doesnt what is the use of maven... I'd check lib folder.
hamam
You ought to know what Maven is doing for you. If you don't, you shouldn't use it. I'd open the WAR file you've created and look to see what's inside it. You're depending too much on tools if you don't know.
duffymo
A: 

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

nokheat
A: 

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

Satesh