How to Fix java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet in Tomcat and Eclipse
1) If you are using Maven and if spring-webmvc is not added as a dependency in your project's pom.xml then please add that.
2) The second step is to add Maven Dependency into deployment assembly.
This is required to move all dependent JAR files into WEB-INF/lib directory of Java web application.
In order to add Maven Dependency into deployment assembly in Eclipse, follow below steps :
i) Right-click your project, select properties and choose Deployment Assembly.
ii) Now click Add and choose Java Build Path Entries and select Maven dependency theirs.
If your project is not set for the automatic build then just refresh the project and build it.
Now you should be able to run your Spring MVC application in attached Tomcat from Eclipse IDE itself.
1) If you are using Maven and if spring-webmvc is not added as a dependency in your project's pom.xml then please add that.
2) The second step is to add Maven Dependency into deployment assembly.
This is required to move all dependent JAR files into WEB-INF/lib directory of Java web application.
In order to add Maven Dependency into deployment assembly in Eclipse, follow below steps :
i) Right-click your project, select properties and choose Deployment Assembly.
ii) Now click Add and choose Java Build Path Entries and select Maven dependency theirs.
If your project is not set for the automatic build then just refresh the project and build it.
Now you should be able to run your Spring MVC application in attached Tomcat from Eclipse IDE itself.