title: How to fix Spring DispatcherServlet class not found?
body: <p>I start to study Spring so I trying to create some simple application using Spring MVC. I saw a lot of propositions how to fix this error, but still didn't solve it. Please if somebody know something, can you help? because I have spent already a lot of time and still have no idea how to resolve it.<br>
  So on the index page I create the next link:</p>
  
  <pre><code> &lt;a href="${pageContext.servletContext.contextPath}/sign/up"&gt;Sign up&lt;/a&gt;
  </code></pre>
  
  <p>which must refer me to a registration page.
  I have hibernate.cfg.xml file which I am using to configure LocalSessionFactoryBean in spring-context.xml. In general <strong>spring-context.xml</strong> looks like: </p>
  
  <pre><code>&lt;beans 
      xmlns="http://www.springframework.org/schema/beans"
      xmlns:aop="http://www.springframework.org/schema/aop"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:security="http://www.springframework.org/schema/security"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="
          http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  
      &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix"&gt;
          &lt;value&gt;/views/&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="suffix"&gt;
          &lt;value&gt;.jsp&lt;/value&gt;
      &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="configLocations"&gt;
          &lt;value&gt;classpath:resources/hibernate.cfg.xml&lt;/value&gt;
      &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.orm.hibernate4.HibernateTemplate"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  
      &lt;context:annotation-config/&gt;
      &lt;context:component-scan base-package="milkiv.easyword"/&gt;
      &lt;tx:annotation-driven/&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>web.xml</strong> like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"&gt;
      &lt;servlet&gt;
      &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;classpath:/resources/spring-context.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;classpath:/resources/spring-context.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>And my controller look like:</p>
  
  <pre><code>@RequestMapping("/sign/up")
  @Controller
  public class Up {
  
      @RequestMapping(method = RequestMethod.GET)
      public String showForm(ModelMap map) {
      return "sign/up";
      }
  
      @RequestMapping(method = RequestMethod.POST)
      public String signUp(@ModelAttribute User user) {
      if (user != null) {
          user.setRegistrationDate(new Date(new java.util.Date().getTime()));
          ApplicationContext context = new ClassPathXmlApplicationContext("resources/spring-context.xml");
          Storages storages = context.getBean(Storages.class);
          storages.uSM.create(user);
      }
      return "sign/up";
      }
  }
  </code></pre>
  
  <p><em>So I have the next problem. When I press on the link, it refer me to EasyWordWeb/sign/up and give me the next exception:</em></p>
  
  <pre><code>type Exception report
  
  message Error instantiating servlet class &gt;org.springframework.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 &gt;org.springframework.web.servlet.DispatcherServlet
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Thread.java:745)
  root cause
  
  java.lang.ClassNotFoundException: &gt;org.springframework.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:502)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>P.S.The jar file where DispatcherServlet actually locate (spring-webmvc-4.2.0.RELEASE.jar) exists in the WEB-INF/lib/ directory.</p>