我们的应用程序使用JBPM来处理工作流程,但是由于一些问题,我们遇到了很多事务问题,导致我们的应用程序无法使用。这并不总是发生,我们无法确切地找出导致这种情况的原因。我们尝试同步调用方法,以便在任何给定时间只有一个线程可以处理它,但这也无济于事。在使用JTA和hibernate进行事务时,有什么我们缺少的吗?
它被部署为自己的容器,只能通过它上面的一个安静的界面访问。
我们正在使用jbpm 5.4.0 堆栈跟踪:
java.lang.RuntimeException: Could not commit transaction
at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:1130)
at org.jbpm.task.service.TaskServiceSession.getEntity(TaskServiceSession.java:1069)
at org.jbpm.task.service.TaskServiceSession.getTask(TaskServiceSession.java:605)
at com.jpmc.rdt.captisflow.service.impl.CaptisLocalTaskService.getTask(CaptisLocalTaskService.java:153)
at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:251)
at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:234)
at com.jpmc.rdt.captisflow.service.impl.CaptisLocalTaskService$SimpleEventTransport.trigger(CaptisLocalTaskService.java:325)
at org.jbpm.task.event.MessagingTaskEventListener.triggerPayload(MessagingTaskEventListener.java:76)
at org.jbpm.task.event.MessagingTaskEventListener.handleEvent(MessagingTaskEventListener.java:92)
at org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:109)
at org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:49)
at org.jbpm.task.service.TaskServiceSession.postTaskCompleteOperation(TaskServiceSession.java:569)
at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:495)
at com.jpmc.rdt.captisflow.service.impl.CaptisLocalTaskService.complete(CaptisLocalTaskService.java:79)
at com.jpmc.rdt.captisflow.service.impl.WorkflowServiceImpl.completeTask(WorkflowServiceImpl.java:388)
at com.jpmc.rdt.captisflow.service.impl.WorkflowServiceImpl.process(WorkflowServiceImpl.java:143)
at com.jpmc.rdt.captisflow.controller.WorkflowController.process(WorkflowController.java:83)
at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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:745)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:685)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:205)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:219)
at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:333)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:193)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:197)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: Unable to rollback transaction
at org.jbpm.task.service.persistence.TaskLocalTransactionManager.rollback(TaskLocalTransactionManager.java:77)
at org.jbpm.task.service.persistence.TaskPersistenceManager.endTransaction(TaskPersistenceManager.java:110)
at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:1118)
... 50 more
Caused by: java.lang.IllegalStateException: Transaction not active
at org.hibernate.ejb.TransactionImpl.rollback(TransactionImpl.java:101)
at org.jbpm.task.service.persistence.TaskLocalTransactionManager.rollback(TaskLocalTransactionManager.java:70)
... 52 more
答案 0 :(得分:0)
这一切都取决于你在框架中做了什么,例如:com.jpmc.rdt.captisflow.service.impl.WorkflowServiceImpl.completeTask(WorkflowServiceImpl.java:388)。那是做什么的?我想你可能会混淆与任务服务的交互方式。您确定没有两种方法同时在任务之上调用操作吗? 当你说异常使应用程序无法使用时,为什么会这样?您是否将此例外传播给用户?大多数情况下,如果存在并发问题,一个操作将成功,另一个操作将失败,从而推动您重试所有失败的操作。