Spring Web MVC Application Error:ClassNotFoundException: DispatcherServlet on deploying

In this video tutorial I will explain you how to resolve the java. lang. ClassNotFoundException: org. springframework. web. servlet. DispatcherServlet Exception while deploying the application on Tomcat server from Eclipse IDE.

Spring Web MVC Application Error:ClassNotFoundException: DispatcherServlet on deploying

This video tutorial is discussing about the Solution of the error  java. lang. ClassNotFoundException: org. springframework. web. servlet. DispatcherServlet

I am discussing about the Spring Web MVC Application Error: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet while deploying on the Tomcat from Eclipse

Eclipse is one of the most used free IDE for development of the application. But some times you may find some error while using the tool. If you are working on Maven based application you might find that the Eclipse is not including the maven dependencies while deploying the application on the Tomcat server. Such error occurs when you try to deploy the application by clicking the "Run As" -> "Run on Server" and then you are selecting the Tomcat server.

The main reason is that the Eclipse is not including the Maven dependencies jar file while running the Tomcat server. Here in this video tutorial I will explain you how to resolve the error. Check the following video tutorial:

Above video tutorial explains you the steps to resolve the Error: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet.

Here is the steps in brief:

Step 1: Open the project setting as shown in the following screen shot:

Solution of the error  java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

and click on "Properties".

Step 2: Selecting the maven libraries.

Select the "Deployment Assembly" as shown bewlow:

Solution of the error  java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

To select the Maven (Spring dependencies) click on the 'Add button' as shown below:

Solution of the error  java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

Then select "Java Build Path Entries" and then click on the "Next >" button as shown below:

Solution of the error  java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

Solution of the error  java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

Now select all the libraries as shown below:

Solution of the error  java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

and then click on the "Finish" button.

Following screen shows all the Maven dependencies jar files are added as shown below:

Solution of the error  java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

Step 3: Run the project on Tomcat.

Now you can run and test your application on Tomcat as shown below:

Solution of the error  java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

In this video you have learned how to add the Maven dependencies to the "Deployment Assembly" so that jar files of the Maven dependencies are used while running the web application on the Tomcat server.

Further reading: