Monday, April 14, 2014

spring "java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet"


Problem
Running the application using eclipse's server you get the following exception:

 spring java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet  

Solution

Check if you have the spring-mvc jar in the project's classpath.
If using maven, you must have something like this in your pom.xml:

<!-- Spring 3 MVC depends on spring-core, spring-beans, spring-context, spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>

</dependency>

If you respective reference is verified and correct, just remove the project from your server.
Perform a project clean, building everything from scratch.
Deploy the project again.

Sometimes, the eclipse's server may fail requiring a new deploy.




No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...