Saturday, 16 January 2016

Solving java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet in Java Spring MVC Application

The  java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet error comes when you deploy a Spring MVC application into Tomcat or Jetty and Servlet container not able to found this class, which usually found in the spring-webmvc.jar file. The DispatcherServlet is the core of Spring MVC framework, it implements the FrontController pattern and intercept all HTTP requests sent to your Web application and subsequently route it to correct controller based upon URL mapping. You need to declare the DispatcherServlet in your web.xml and specify the URL pattern such that Servlet container like Tomcat should send all HTTP request to DispatcherServlet. We also set load-on-startup tag as 1 for this Servlet, so that it should be loaded at deployment time. This Servlet is the link between Servlet Container and Spring MVC framework.
Read more »

No comments:

Post a Comment