title: HTTP Status 500 - Error instantiating servlet class org.springframeworks.web.servlet.DispatcherServlet
body: <pre><code>HTTP Status 500 - Error instantiating servlet class org.springframeworks.web.servlet.DispatcherServlet
  
  
  type Exception report
  
  message Error instantiating servlet class org.springframeworks.web.servlet.DispatcherServlet
  
  description The server encountered an internal error that prevented it from fulfilling this request.
  
  exception
  javax.servlet.ServletException: Error instantiating servlet class org.springframeworks.web.servlet.DispatcherServlet
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)
      java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Unknown Source)
  
  
  root cause
  java.lang.ClassNotFoundException: org.springframeworks.web.servlet.DispatcherServlet
      org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
      org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)
      java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Unknown Source)
  
  
  note The full stack trace of the root cause is available in the Apache Tomcat/8.0.41 logs.**strong text**
  
  
  Apache Tomcat/8.0.41
  </code></pre>
  
  <p>Logs:</p>
  
  <p>SEVERE: Allocate exception for servlet dispatcher
  java.lang.ClassNotFoundException: org.springframeworks.web.servlet.DispatcherServlet
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
      at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:518)
      at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:499)
      at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Unknown Source)</p>
  
  <p>Dispatcher-Servlet.xml</p>
  
  <pre><code>&lt;!--  Let Front Controller know where the other controller 
  allign so than i have added context Element --&gt;
  &lt;beans xmlns = "http://www.springframework.org/schema/beans"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation = "
     http://www.springframework.org/schema/beans
     http://www.springframework.org/schema/beans/spring-beans.xsd
     http://www.springframework.org/schema/context
     http://www.springframework.org/schema/context/spring-context.xsd
     "&gt;
  
     &lt;context:component-scan base-package="com.irk.FrontEndShoping.Controller" /&gt;
  
     &lt;bean id="viewResolver" 
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/WEB-INF/views/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
  
          &lt;/bean&gt;
  
     &lt;/beans&gt;
  </code></pre>
  
  <p>Web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"&gt;
    &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframeworks.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Page.jsp:</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Online Shoping&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;  
      ${Greeting}
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Pom.xml:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.irk&lt;/groupId&gt;
      &lt;artifactId&gt;FrontEndShoping&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;FrontEndShoping Maven Webapp&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;properties&gt;
          &lt;javaee.version&gt;7.0&lt;/javaee.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;!-- spring mvc --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;4.3.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
  
  
          &lt;!-- https://mvnrepository.com/artifact/javax/javaee-api --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax&lt;/groupId&gt;
              &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
              &lt;version&gt;${javaee.version}&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
          &lt;finalName&gt;FrontEndShoping&lt;/finalName&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>PageController:</p>
  
  <pre><code>package com.irk.FrontEndShoping.Controller;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.servlet.ModelAndView;
  
  /**
   * 
   * @author HP
   *
   */
  @Controller
  public class PageController {
  
      @RequestMapping(value = {"/", "/home", "/index"})
      public ModelAndView getPage() {
          ModelAndView mv = new ModelAndView("page");
          mv.addObject("Greeting", "Hello its Greeting from Controller");
          return mv;
      }
  }
  </code></pre>
  
  <p>Using:<br>
  package com.irk.FrontEndShoping.Controller;</p>
  
  <pre><code>import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.servlet.ModelAndView;
  
  /**
   * 
   * @author HP
   *
   */
  @Controller
  public class PageController {
  
      @RequestMapping(value = {"/", "/home", "/index"})
      public ModelAndView getPage() {
          ModelAndView mv = new ModelAndView("page");
          mv.addObject("Greeting", "Hello its Greeting from Controller");
          return mv;
      }
  }
  </code></pre>
  
  <p>Using:</p>
  
  <pre><code>java version "1.8.0_121"
  Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
  Apache Maven 3.3.3
  Apache Tomcate:  apache-tomcat-8.0.41
  </code></pre>
  
  <p>Could you please explain me Why this error is Coming 
  and how to solve all the 500 error when it comes 
  Kindly need some specific i have seen so many different different solution which is not working i am looking for some proper answer which should applicable for 500 errors </p>