title: Why this exception Java?
body: <p>I'm studying servlets and I'm trying to create a small program to get the hour through a class that I've created. But I've bee getting a exception. Here is the code:</p>
  
  <p>User</p>
  
  <pre><code>package Business;
  
  public class User {
  
      private String userId;
  
      public User() {
          userId = "";
      }
  
      public User(String id) {
          userId = id;
      }
  
      public void setUserId(String id) {
          userId = id;
      }
  
      public String getUserId() {
          return userId;
      }
  
  }
  </code></pre>
  
  <p>Hours</p>
  
  <pre><code>package Business;
  
  import java.util.Calendar;
  import java.util.GregorianCalendar;
  
  import business.User;
  
  public class Hours {
  
      private User user;
      private Calendar cal = new GregorianCalendar();
      private int min = 0;
  
      public Hours(User user) {
          this.user = user;
          min = cal.get(Calendar.MINUTE);
      }
  
      public String getMinutes() {
          return Integer.toString(min);
      }
  
      public User getUser() {
          return user;
      }
  
  }
  </code></pre>
  
  <p>CheckUser</p>
  
  <pre><code>package process;
  
  import java.io.IOException;
  import java.io.PrintWriter;
  import javax.servlet.RequestDispatcher;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import Business.User;
  import Business.Hours;
  
  public class CheckUser extends HttpServlet {
  
      protected void processRequest(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          String userId = request.getParameter("userID");
          User user1 = new User(userId);
          Hours h1 = new Hours(user1);
          String url = "/show.jsp";
  
          request.setAttribute("hours", h1);
  
          RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
          dispatcher.forward(request, response);
  
      }
  
      @Override
      protected void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          String userId = request.getParameter("userID");
          User user1 = new User(userId);
          Hours h1 = new Hours(user1);
          String url = "/show.jsp";
  
          request.setAttribute("hours", h1);
  
          RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
          dispatcher.forward(request, response);
      }
  
  
      @Override
      protected void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          String userId = request.getParameter("userID");
          User user1 = new User(userId);
          Hours h1 = new Hours(user1);
          String url = "/show.jsp";
  
          request.setAttribute("hours", h1);
  
          RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
          dispatcher.forward(request, response);
      }
  
  }
  </code></pre>
  
  <p>Index</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;Project&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Employees&lt;/h1&gt;
          &lt;form action="&lt;%=response.encodeURL("CheckUser")%&gt;" method="get"&gt;
              &lt;input type="submit" value="Diogo"&gt;
              &lt;input type="hidden" name="userId" value="1"&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Show</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;JSP Page&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;%@ page import="Business.*, process.*" %&gt;
  
          &lt;%
              Hours h1 = (Hours) request.getAttribute("hours");
              String userId =h1.getUser().getUserId();
          %&gt;
          &lt;h1&gt;&lt;%= userId %&gt;&lt;/h1&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Exception</p>
  
  <blockquote>
    <p>type Exception report</p>
    
    <p>message</p>
    
    <p>description The server encountered an internal error () that prevented
    it from fulfilling this request.</p>
    
    <p>exception</p>
    
    <blockquote>
      <p>java.lang.RuntimeException: Uncompilable source code - Erroneous ctor sym type:     process.CheckUser.doGet(CheckUser.java:37)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:722) note The
      full stack trace of the root cause is available in the Apache
      Tomcat/7.0.23 logs.</p>
    </blockquote>
  </blockquote>