title: SEVERE: Allocate exception for servlet, error when trying to call a servlet from JSP page
body: <p>When I run the jsp on the tomcat server and it runs ok, but when I click submit it throws the following error, I have checked over everything and I am not sure where to go from here because it seems like it should work, any help would be much appreciated, Thank you.</p>
  
  <p>Error Stack Trace:</p>
  
  <pre><code>SEVERE: Allocate exception for servlet RegistrationServlet
  java.lang.ClassNotFoundException: logon.RegistrationServlet.java
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
  at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529)
  at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511)
  at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1148)
  at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
  </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://java.sun.com/xml/ns/javaee" 
  xmlns:web="http://java.sun.com/xml/ns/javaee" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns /javaee    /web-app_2_5.xsd" 
  id="WebApp_ID" version="2.5"&gt;
  &lt;display-name&gt;RegistrationTest&lt;/display-name&gt;
   &lt;servlet&gt;
          &lt;display-name&gt;RegistrationServlet&lt;/display-name&gt;
          &lt;servlet-name&gt;RegistrationServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;logon.RegistrationServlet&lt;/servlet-class&gt;
   &lt;/servlet&gt;
   &lt;servlet-mapping&gt;
       &lt;servlet-name&gt;RegistrationServlet&lt;/servlet-name&gt;
       &lt;url-pattern&gt;/RegistrationServlet&lt;/url-pattern&gt;
   &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>The JSP page:</p>
  
  <pre><code>&lt;h2&gt;Signup Details&lt;/h2&gt;
          &lt;form name="actionForm" action="RegistrationServlet" method ="post"&gt;
          &lt;br/&gt;Username:&lt;input type="text" name="name"&gt;
          &lt;br/&gt;Password:&lt;input type="password" name="password"&gt;
          &lt;br/&gt;Email:&lt;input type="text" name="email"&gt;
          &lt;br/&gt;&lt;input type="submit" value="Submit"&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>The Servlet:</p>
  
  <pre><code>import java.io.IOException;
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  /**
    * Servlet implementation class RegistrationServlet
   */
  @WebServlet("/RegistrationServlet")
  public class RegistrationServlet extends HttpServlet {
  private static final long serialVersionUID = 1L;
  
  public RegistrationServlet() {
      super();
  
  }
  
  
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
  }
  
  
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      try{
          System.out.println("In the registration Servlet");
          User user = new User();
          user.setName(request.getParameter("name"));
          user.setPassword(request.getParameter("password"));
          user.setEmail(request.getParameter("email"));
          RegisterUser.addUser(user);
          //response.sendRedirect("welcome.jsp");        
      } catch (Throwable exc)
      {
          System.out.println(exc);
      }
  }
  
  }
  </code></pre>