Hibernate Persistance ObjectNotFoundException:不存在具有给定标识符的行

时间:2015-07-12 16:09:53

标签: java spring hibernate

在打开必须从数据库显示Task列表的JSP页面时,我得到的异常也在标题中。我已经检查了很多其他答案,但无济于事,我现在无法弄清楚出了什么问题,所以我正在寻求帮助。

我需要生成一个Task列表,其中包含对UserProject的引用。 我正在使用h2数据库。

以下是表格:

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),
);

这是DAO课程:

@Repository
public class TaskDaoHibernate implements TaskDao {
public TaskDaoHibernate() {
}

@Autowired
private SessionFactory sessionFactory;

private Session getCurrentSession() {
    return sessionFactory.getCurrentSession();
}

@SuppressWarnings("unchecked")
@Override
public List<User> 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<Project> 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<Task> 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;
}


}

这是User类,其映射原理与Project:

相同
@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<Task> task) {
    this.task = task;
}

@OneToMany(mappedBy="userId", fetch=FetchType.EAGER)
private List<Task> task;

public User(){}

//getters, setters, overriden equals and hashcode

这是Task类:

@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(){

}

完整堆栈跟踪是:

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)

编辑: 这是被要求的JSP:

<body>
<sf:form id="form" method="POST" action="fetchAllTasks.html"
    modelAttribute="chosenTask">
    <table id='reportTable' class='display' border="1"
        style="font-family: Arial; font-size: 18px;">
        <tr>
            <td><fmt:message key="taskList.num" /></td>
            <td><fmt:message key="taskList.lastName" /></td>
            <td><fmt:message key="taskList.firstName" /></td>
            <td><fmt:message key="taskList.username" /></td>
            <td><fmt:message key="taskList.projectName" /></td>
            <td><fmt:message key="taskList.companyName" /></td>
            <td><fmt:message key="taskList.description" /></td>
            <td><fmt:message key="taskList.estimation" /></td>
            <sec:authorize access="hasRole('Administrator')">
                <td><fmt:message key="edit" /></td>
            </sec:authorize>
        </tr>
        <c:forEach var="task" items="${tasksList}">
            <tr>
                <td style="text-align: center;"><c:out value="${task.id}" /></td>
                <td style="text-align: center;"><c:out
                        value="${task.user.ime}" /></td>
                <td style="text-align: center;"><c:out
                        value="${task.user.prezime}" /></td>
                <td style="text-align: center;"><c:out
                        value="${task.user.korisnickoIme}" /></td>
                <td style="text-align: center;"><c:out
                        value="${task.project.nazivProjekta}" /></td>
                <td style="text-align: center;"><c:out
                        value="${task.project.nazivTvrtke}" /></td>

                <td style="text-align: center;"><c:out
                        value="${task.opisZadatka}" /></td>
                <td style="text-align: center;"><c:out
                        value="${task.trajanje}" /></td>

                <sec:authorize access="hasRole('Administrator')">
                    <td style="text-align: center;">

                        <button id="${task.id}" onClick="chooseTask(this.id)">
                            <fmt:message key="edit" />
                        </button>
                    </td>
                </sec:authorize>
            </tr>
        </c:forEach>
    </table>
    <input type="hidden" name="chosenTask" id="chosenTask" />
</sf:form>
<div>
    <center>

        <form:form method="POST">

            <input type="submit" name="backButton"
                value="<fmt:message key="taskList.button" /> ">
        </form:form>
        <form method="POST" action="j_spring_security_logout">
            <input type="submit" value="<fmt:message key="logout" />">
        </form>
        <jsp:include page="/WEB-INF/jsp/i18n/langSelect.jsp" />
    </center>
</div>

<script type="text/javascript">
    function chooseTask(clicked_id) {
        document.getElementById("chosenTask").value = clicked_id;

    }
</script>
</body>

0 个答案:

没有答案