title: Hibernate Persistance ObjectNotFoundException: No row with the given identifier exists
body: <p>While opening JSP page that has to show a list of <code>Task</code> from database, I am getting exception that is also in title. I've checked numerous other answers, but to no avail, I can't figure out what is wrong now, so I am asking for help.</p>
  
  <p>I need to generate a list of <code>Task</code> that has references to <code>User</code> and  <code>Project</code>.
  I am using h2 database.</p>
  
  <p>Here are the tables:</p>
  
  <pre><code>CREATE TABLE TASK.APP_USER (
  id INT NOT NULL GENERATED ALWAYS AS IDENTITY,
  username VARCHAR(25) NOT NULL,
  firstName VARCHAR(25) NOT NULL,
  lastName VARCHAR(25) NOT NULL,
  password VARCHAR(32) NOT NULL,
  PRIMARY KEY (id)
  );
  
  CREATE TABLE TASK.PROJECT (
  id INT GENERATED ALWAYS AS IDENTITY,
  name VARCHAR(50) NOT NULL,
  companyName VARCHAR(50) NOT NULL,
  PRIMARY KEY (id)
  );
  
  CREATE TABLE TASK.PROJECT_TASK (
  id INT GENERATED ALWAYS AS IDENTITY,
  projectId INT NOT NULL,
  userId INT NOT NULL,
  description VARCHAR(500) NOT NULL,
  estimatedDurationHours INT NOT NULL,
  PRIMARY KEY (id),
  FOREIGN KEY (projectId) REFERENCES TASK.PROJECT(id),
  FOREIGN KEY (userId) REFERENCES TASK.APP_USER(id),
  );
  </code></pre>
  
  <p>Here is the DAO class:</p>
  
  <pre><code>@Repository
  public class TaskDaoHibernate implements TaskDao {
  public TaskDaoHibernate() {
  }
  
  @Autowired
  private SessionFactory sessionFactory;
  
  private Session getCurrentSession() {
      return sessionFactory.getCurrentSession();
  }
  
  @SuppressWarnings("unchecked")
  @Override
  public List&lt;User&gt; fetchAllUsers() {
      return getCurrentSession().createQuery("from User").list();
  }
  
  @Override
  public User fetchUserById(Integer userId) {
      return (User) getCurrentSession().get(User.class, userId);
  }
  
  @SuppressWarnings("unchecked")
  @Override
  public List&lt;Project&gt; fetchAllProjects() {
      return getCurrentSession().createQuery("from Project").list();
  }
  
  @Override
  public Project fetchProjectById(Integer projectId) {
      return (Project) getCurrentSession().get(Project.class, projectId);
  }
  
  @Override
  public void saveTask(Task task) {
      getCurrentSession().save(task);
          }
  
  @SuppressWarnings("unchecked")
  @Override
  public List&lt;Task&gt; fetchAllTasks() {
      return getCurrentSession().createQuery("from Task").list();
  }
  
  @Override
  public Task fetchTaskById(Integer taskId) {
      return (Task) getCurrentSession().get(Task.class, taskId);
  }
  
  @Override
  public void editTask(Task task) {
      getCurrentSession().update(task);
          }
  
  public SessionFactory getSessionFactory() {
      return sessionFactory;
  }
  
  public void setSessionFactory(SessionFactory sessionFactory) {
      this.sessionFactory = sessionFactory;
  }
  
  
  }
  </code></pre>
  
  <p>Here is the User class, mapped on the same principles as Project:</p>
  
  <pre><code>@Entity
  @Table(name="TASK.APP_USER")
  public class User implements Serializable {
  /**
       * 
       */
  private static final long serialVersionUID = 1L;
  
  @Id
  @Column(name = "ID")
  @GeneratedValue
  private int id;
  
  @Column(name = "USERNAME")
  private String korisnickoIme;
  
  @Column(name = "FIRSTNAME")
  private String ime;
  
  @Column(name = "LASTNAME")
  private String prezime;
  
  
  public void setTask(List&lt;Task&gt; task) {
      this.task = task;
  }
  
  @OneToMany(mappedBy="userId", fetch=FetchType.EAGER)
  private List&lt;Task&gt; task;
  
  public User(){}
  
  //getters, setters, overriden equals and hashcode
  </code></pre>
  
  <p>And here is the Task class:</p>
  
  <pre><code>@Entity
  @Table(name="TASK.PROJECT_TASK")
  public class Task implements Serializable {
  
  /**
   * 
   */
  private static final long serialVersionUID = -4633753821563474175L;
  
  @ManyToOne(optional = true)
  @JoinColumn(name="ID", insertable=false, updatable=false)
  private User user;
  
  @ManyToOne(optional = true)
  @JoinColumn(name="ID", insertable=false, updatable=false)
  private Project project;
  
  @Column(name = "PROJECTID")
  private Integer projectId;
  
  @Column(name = "USERID")
  private Integer userId;
  
  @Column(name = "DESCRIPTION ")
  private String opisZadatka;
  
  @Column(name = "ESTIMATEDDURATIONHOURS")
  private Integer trajanje;
  
  @Id
  @Column(name = "ID")
  @GeneratedValue
  private Integer id;
  
  public Task(){
  
  }
  </code></pre>
  
  <p>Full stack trace is:</p>
  
  <pre><code>INFO: Server startup in 6905 ms
  Hibernate: 
  select
      task0_.ID as ID1_2_,
      task0_.DESCRIPTION  as DESCRIPT2_2_,
      task0_.PROJECTID as PROJECTI3_2_,
      task0_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_,
      task0_.USERID as USERID5_2_ 
  from
      TASK.PROJECT_TASK task0_
  Hibernate: 
  select
      project0_.ID as ID1_1_0_,
      project0_.NAME as NAME2_1_0_,
      project0_.COMPANYNAME as COMPANYN3_1_0_,
      task1_.PROJECTID as PROJECTI3_1_1_,
      task1_.ID as ID1_2_1_,
      task1_.ID as ID1_2_2_,
      task1_.DESCRIPTION  as DESCRIPT2_2_2_,
      task1_.PROJECTID as PROJECTI3_2_2_,
      task1_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_2_,
      task1_.USERID as USERID5_2_2_,
      project2_.ID as ID1_1_3_,
      project2_.NAME as NAME2_1_3_,
      project2_.COMPANYNAME as COMPANYN3_1_3_ 
  from
      TASK.PROJECT project0_ 
  left outer join
      TASK.PROJECT_TASK task1_ 
          on project0_.ID=task1_.PROJECTID 
  left outer join
      TASK.PROJECT project2_ 
          on task1_.ID=project2_.ID 
  where
      project0_.ID=?
  Hibernate: 
  select
      user0_.ID as ID1_0_0_,
      user0_.FIRSTNAME as FIRSTNAM2_0_0_,
      user0_.USERNAME as USERNAME3_0_0_,
      user0_.LASTNAME as LASTNAME4_0_0_,
      task1_.USERID as USERID5_0_1_,
      task1_.ID as ID1_2_1_,
      task1_.ID as ID1_2_2_,
      task1_.DESCRIPTION  as DESCRIPT2_2_2_,
      task1_.PROJECTID as PROJECTI3_2_2_,
      task1_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_2_,
      task1_.USERID as USERID5_2_2_,
      project2_.ID as ID1_1_3_,
      project2_.NAME as NAME2_1_3_,
      project2_.COMPANYNAME as COMPANYN3_1_3_,
      task3_.PROJECTID as PROJECTI3_1_4_,
      task3_.ID as ID1_2_4_,
      task3_.ID as ID1_2_5_,
      task3_.DESCRIPTION  as DESCRIPT2_2_5_,
      task3_.PROJECTID as PROJECTI3_2_5_,
      task3_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_5_,
      task3_.USERID as USERID5_2_5_ 
  from
      TASK.APP_USER user0_ 
  left outer join
      TASK.PROJECT_TASK task1_ 
          on user0_.ID=task1_.USERID 
  left outer join
      TASK.PROJECT project2_ 
          on task1_.ID=project2_.ID 
  left outer join
      TASK.PROJECT_TASK task3_ 
          on project2_.ID=task3_.PROJECTID 
  where
      user0_.ID=?
  Hibernate: 
  select
      project0_.ID as ID1_1_0_,
      project0_.NAME as NAME2_1_0_,
      project0_.COMPANYNAME as COMPANYN3_1_0_,
      task1_.PROJECTID as PROJECTI3_1_1_,
      task1_.ID as ID1_2_1_,
      task1_.ID as ID1_2_2_,
      task1_.DESCRIPTION  as DESCRIPT2_2_2_,
      task1_.PROJECTID as PROJECTI3_2_2_,
      task1_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_2_,
      task1_.USERID as USERID5_2_2_,
      project2_.ID as ID1_1_3_,
      project2_.NAME as NAME2_1_3_,
      project2_.COMPANYNAME as COMPANYN3_1_3_ 
  from
      TASK.PROJECT project0_ 
  left outer join
      TASK.PROJECT_TASK task1_ 
          on project0_.ID=task1_.PROJECTID 
  left outer join
      TASK.PROJECT project2_ 
          on task1_.ID=project2_.ID 
  where
      project0_.ID=?
  Hibernate: 
  select
      user0_.ID as ID1_0_0_,
      user0_.FIRSTNAME as FIRSTNAM2_0_0_,
      user0_.USERNAME as USERNAME3_0_0_,
      user0_.LASTNAME as LASTNAME4_0_0_,
      task1_.USERID as USERID5_0_1_,
      task1_.ID as ID1_2_1_,
      task1_.ID as ID1_2_2_,
      task1_.DESCRIPTION  as DESCRIPT2_2_2_,
      task1_.PROJECTID as PROJECTI3_2_2_,
      task1_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_2_,
      task1_.USERID as USERID5_2_2_,
      project2_.ID as ID1_1_3_,
      project2_.NAME as NAME2_1_3_,
      project2_.COMPANYNAME as COMPANYN3_1_3_,
      task3_.PROJECTID as PROJECTI3_1_4_,
      task3_.ID as ID1_2_4_,
      task3_.ID as ID1_2_5_,
      task3_.DESCRIPTION  as DESCRIPT2_2_5_,
      task3_.PROJECTID as PROJECTI3_2_5_,
      task3_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_5_,
      task3_.USERID as USERID5_2_5_ 
  from
      TASK.APP_USER user0_ 
  left outer join
      TASK.PROJECT_TASK task1_ 
          on user0_.ID=task1_.USERID 
  left outer join
      TASK.PROJECT project2_ 
          on task1_.ID=project2_.ID 
  left outer join
      TASK.PROJECT_TASK task3_ 
          on project2_.ID=task3_.PROJECTID 
  where
      user0_.ID=?
  Hibernate: 
  select
      user0_.ID as ID1_0_0_,
      user0_.FIRSTNAME as FIRSTNAM2_0_0_,
      user0_.USERNAME as USERNAME3_0_0_,
      user0_.LASTNAME as LASTNAME4_0_0_,
      task1_.USERID as USERID5_0_1_,
      task1_.ID as ID1_2_1_,
      task1_.ID as ID1_2_2_,
      task1_.DESCRIPTION  as DESCRIPT2_2_2_,
      task1_.PROJECTID as PROJECTI3_2_2_,
      task1_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_2_,
      task1_.USERID as USERID5_2_2_,
      project2_.ID as ID1_1_3_,
      project2_.NAME as NAME2_1_3_,
      project2_.COMPANYNAME as COMPANYN3_1_3_,
      task3_.PROJECTID as PROJECTI3_1_4_,
      task3_.ID as ID1_2_4_,
      task3_.ID as ID1_2_5_,
      task3_.DESCRIPTION  as DESCRIPT2_2_5_,
      task3_.PROJECTID as PROJECTI3_2_5_,
      task3_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_5_,
      task3_.USERID as USERID5_2_5_ 
  from
      TASK.APP_USER user0_ 
  left outer join
      TASK.PROJECT_TASK task1_ 
          on user0_.ID=task1_.USERID 
  left outer join
      TASK.PROJECT project2_ 
          on task1_.ID=project2_.ID 
  left outer join
      TASK.PROJECT_TASK task3_ 
          on project2_.ID=task3_.PROJECTID 
  where
      user0_.ID=?
  Hibernate: 
  select
      project0_.ID as ID1_1_0_,
      project0_.NAME as NAME2_1_0_,
      project0_.COMPANYNAME as COMPANYN3_1_0_,
      task1_.PROJECTID as PROJECTI3_1_1_,
      task1_.ID as ID1_2_1_,
      task1_.ID as ID1_2_2_,
      task1_.DESCRIPTION  as DESCRIPT2_2_2_,
      task1_.PROJECTID as PROJECTI3_2_2_,
      task1_.ESTIMATEDDURATIONHOURS as ESTIMATE4_2_2_,
      task1_.USERID as USERID5_2_2_,
      project2_.ID as ID1_1_3_,
      project2_.NAME as NAME2_1_3_,
      project2_.COMPANYNAME as COMPANYN3_1_3_ 
  from
      TASK.PROJECT project0_ 
  left outer join
      TASK.PROJECT_TASK task1_ 
          on project0_.ID=task1_.PROJECTID 
  left outer join
      TASK.PROJECT project2_ 
          on task1_.ID=project2_.ID 
  where
      project0_.ID=?
  srp 12, 2015 6:07:06 PM
  org.hibernate.event.internal.DefaultLoadEventListener onLoad
  INFO: HHH000327: Error performing load command
   org.hibernate.ObjectNotFoundException: No row with the given identifier exists:     [hr.tvz.web.aplikacije.domain.Project#4]
  srp 12, 2015 6:07:06 PM org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet [springDispatcher] in context with path [/Majcenic_8] threw exception [Request processing failed; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [hr.tvz.web.aplikacije.domain.Project#4]] with root cause
  org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [hr.tvz.web.aplikacije.domain.Project#4]
  at  org.hibernate.internal.SessionFactoryImpl$1$1.handleEntityNotFound(SessionFactoryImpl.java:253)
  at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:219)
  at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:275)
  at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:151)
  at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1106)
  at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1025)
  at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:716)
  at org.hibernate.type.EntityType.resolve(EntityType.java:502)
  at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:170)
  at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:144)
  at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1115)
  at org.hibernate.loader.Loader.processResultSet(Loader.java:973)
  at org.hibernate.loader.Loader.doQuery(Loader.java:921)
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355)
  at org.hibernate.loader.Loader.doList(Loader.java:2554)
  at org.hibernate.loader.Loader.doList(Loader.java:2540)
  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370)
  at org.hibernate.loader.Loader.list(Loader.java:2365)
  at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:497)
  at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387)
  at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:236)
  at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1300)
  at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103)
  at hr.tvz.web.aplikacije.dao.TaskDaoHibernate.fetchAllTasks(TaskDaoHibernate.java:56)
  at hr.tvz.web.aplikacije.service.TaskServiceImpl.fetchAllTasks(TaskServiceImpl.java:54)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
  at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
  at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
  at com.sun.proxy.$Proxy30.fetchAllTasks(Unknown Source)
  at hr.tvz.web.aplikacije.controller.FetchAllTasksController.fetchDataAndShowScreen(FetchAllTasksController.java:25)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
  at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
  at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>EDIT:
  Here is the JSP that has been asked for:</p>
  
  <pre><code>&lt;body&gt;
  &lt;sf:form id="form" method="POST" action="fetchAllTasks.html"
      modelAttribute="chosenTask"&gt;
      &lt;table id='reportTable' class='display' border="1"
          style="font-family: Arial; font-size: 18px;"&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;fmt:message key="taskList.num" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;fmt:message key="taskList.lastName" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;fmt:message key="taskList.firstName" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;fmt:message key="taskList.username" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;fmt:message key="taskList.projectName" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;fmt:message key="taskList.companyName" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;fmt:message key="taskList.description" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;fmt:message key="taskList.estimation" /&gt;&lt;/td&gt;
              &lt;sec:authorize access="hasRole('Administrator')"&gt;
                  &lt;td&gt;&lt;fmt:message key="edit" /&gt;&lt;/td&gt;
              &lt;/sec:authorize&gt;
          &lt;/tr&gt;
          &lt;c:forEach var="task" items="${tasksList}"&gt;
              &lt;tr&gt;
                  &lt;td style="text-align: center;"&gt;&lt;c:out value="${task.id}" /&gt;&lt;/td&gt;
                  &lt;td style="text-align: center;"&gt;&lt;c:out
                          value="${task.user.ime}" /&gt;&lt;/td&gt;
                  &lt;td style="text-align: center;"&gt;&lt;c:out
                          value="${task.user.prezime}" /&gt;&lt;/td&gt;
                  &lt;td style="text-align: center;"&gt;&lt;c:out
                          value="${task.user.korisnickoIme}" /&gt;&lt;/td&gt;
                  &lt;td style="text-align: center;"&gt;&lt;c:out
                          value="${task.project.nazivProjekta}" /&gt;&lt;/td&gt;
                  &lt;td style="text-align: center;"&gt;&lt;c:out
                          value="${task.project.nazivTvrtke}" /&gt;&lt;/td&gt;
  
                  &lt;td style="text-align: center;"&gt;&lt;c:out
                          value="${task.opisZadatka}" /&gt;&lt;/td&gt;
                  &lt;td style="text-align: center;"&gt;&lt;c:out
                          value="${task.trajanje}" /&gt;&lt;/td&gt;
  
                  &lt;sec:authorize access="hasRole('Administrator')"&gt;
                      &lt;td style="text-align: center;"&gt;
  
                          &lt;button id="${task.id}" onClick="chooseTask(this.id)"&gt;
                              &lt;fmt:message key="edit" /&gt;
                          &lt;/button&gt;
                      &lt;/td&gt;
                  &lt;/sec:authorize&gt;
              &lt;/tr&gt;
          &lt;/c:forEach&gt;
      &lt;/table&gt;
      &lt;input type="hidden" name="chosenTask" id="chosenTask" /&gt;
  &lt;/sf:form&gt;
  &lt;div&gt;
      &lt;center&gt;
  
          &lt;form:form method="POST"&gt;
  
              &lt;input type="submit" name="backButton"
                  value="&lt;fmt:message key="taskList.button" /&gt; "&gt;
          &lt;/form:form&gt;
          &lt;form method="POST" action="j_spring_security_logout"&gt;
              &lt;input type="submit" value="&lt;fmt:message key="logout" /&gt;"&gt;
          &lt;/form&gt;
          &lt;jsp:include page="/WEB-INF/jsp/i18n/langSelect.jsp" /&gt;
      &lt;/center&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
      function chooseTask(clicked_id) {
          document.getElementById("chosenTask").value = clicked_id;
  
      }
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>