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:
and click on "Properties".
Step 2: Selecting the maven libraries.
Select the "Deployment Assembly" as shown bewlow:
To select the Maven (Spring dependencies) click on the 'Add button' as shown below:
Then select "Java Build Path Entries" and then click on the "Next >" button as shown below:
Now select all the libraries as shown below:
and then click on the "Finish" button.
Following screen shows all the Maven dependencies jar files are added as shown below:
Step 3: Run the project on Tomcat.
Now you can run and test your application on Tomcat as shown below:
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.
Liked it! Share this Tutorial