Java.Lang.ClassNotFoundException: Org.SpringFramework.Web.Servlet.DispatcherServlet

Muhammad Zeeshan Jan 30, 2023 Aug 16, 2022
  1. What Is the java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
  2. Causes of java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
  3. Solution of java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
Java.Lang.ClassNotFoundException: Org.SpringFramework.Web.Servlet.DispatcherServlet

The error java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet is going to be covered in today’s post on Java.

What Is the java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

You may see this exception while implementing a Spring MVC application to Servlet containers because of the java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet, often in the spring-webmvc.jar file, cannot be found.

In the Spring MVC framework, the DispatcherServlet intercepts all HTTP requests and routes them to the appropriate controllers based on URL mapping, which is the heart of the FrontController pattern.

The Servlet container and Spring MVC framework rely on DispatcherServlet to communicate. Servlet containers must deliver or route all HTTP requests to the specified DispatcherServlet, which has to be declared in your web.xml and given a URL pattern.

Causes of java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

The following are examples of possible reasons for the exception.

  1. Check to see whether the configuration file can be opened. If it cannot, you need to update the correct package name in the line that reads <servlet-class></servlet-class> in the web.xml file.

  2. At the time of Tomcat’s initialization, the required Spring MVC related .jar files are not loaded and implemented. However, given these files are already in your classpath, we’ll not experience any errors when using the Eclipse IDE to create the program.

    This only occurs when the program is executing.

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

Although the right path to the package is opened, the path is not imported into the WEB-INF/lib directory. The following is the particular solution to the problem.

  1. To start, open the Eclipse IDE application and create a new project by the below steps.

    From the left upper corner select File > New > Java Project, to create a new project.

    create a new project

    After creating a new project, name it.

    name a new project

  2. Next, select Properties from the drop-down list that appears when we right-click on the project that we just created.


  1. After that, select Deployment Assembly from the panel on the left of the screen. If you’re working on Spring MVC, you will see Deployment Assembly.

    Otherwise, it will not appear on the list.

    deployment assembly

  2. To specify the packing structure, click the OK button.

  3. There will appear a new window. Click Add and then choose Java Build Path Entries from the list.

    Java Build Path Entries

  4. After selecting all of the libraries, click the Finish button to complete the process.

  5. Click on Maven Dependencies on the new window to include all Maven’s .jar files.

    Maven Dependencies

  6. You can now test your application by running it on Tomcat.

Muhammad Zeeshan avatar Muhammad Zeeshan avatar

I have been working as a Flutter app developer for a year now. Firebase and SQLite have been crucial in the development of my android apps. I have experience with C#, Windows Form Based C#, C, Java, PHP on WampServer, and HTML/CSS on MYSQL, and I have authored articles on their theory and issue solving. I'm a senior in an undergraduate program for a bachelor's degree in Information Technology.


Related Article - Java Exception