Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot Spring boot Activiti TaskUser在执行TaskService.complete时导致回滚_Spring Boot_Rollback_Activiti_Taskservice - Fatal编程技术网

Spring boot Spring boot Activiti TaskUser在执行TaskService.complete时导致回滚

Spring boot Spring boot Activiti TaskUser在执行TaskService.complete时导致回滚,spring-boot,rollback,activiti,taskservice,Spring Boot,Rollback,Activiti,Taskservice,工作流在UserTask处挂起。在设置了本地变量和流程变量之后,我尝试调用TaskService.complete(task.getId())。离开该方法时,它将回滚。但是,我无法看到异常的实际原因 我使用的是Spring boot 1.5.10.0版本 下面是我的maven for activiti的快照: <groupId>org.activiti</groupId> <artifactId>spring-b

工作流在UserTask处挂起。在设置了本地变量和流程变量之后,我尝试调用TaskService.complete(task.getId())。离开该方法时,它将回滚。但是,我无法看到异常的实际原因

我使用的是Spring boot 1.5.10.0版本

下面是我的maven for activiti的快照:

            <groupId>org.activiti</groupId>
            <artifactId>spring-boot-starter-basic</artifactId>
            <version>5.17.0</version>
        </dependency>
        <dependency>
            <groupId>org.activiti</groupId>
            <artifactId>spring-boot-starter-jpa</artifactId>
            <version>5.17.0</version>
        </dependency>
org.activiti
弹簧启动机基本
5.17.0
org.activiti
弹簧启动机jpa
5.17.0
这是bpmn文件。我已经成功地启动了一个新的进程,该进程对前2个“stLockCourseMarks”服务任务和“IsCourseMarkLocked”独占网关执行良好。因此,它在“调节”用户任务时暂停:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="cma3" name="Course Marks Approval Workflow v3" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="stLockCourseMarks" name="Lock Course Marks" activiti:class="org.bcaa.sms.service.workflow.delegate.LockCourseMarks"></serviceTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="stLockCourseMarks"></sequenceFlow>
    <exclusiveGateway id="IsCourseMarkLocked" name="Course Mark Lock Gateway" default="lockFailedFlow"></exclusiveGateway>
    <sequenceFlow id="flow2" sourceRef="stLockCourseMarks" targetRef="IsCourseMarkLocked"></sequenceFlow>
    <userTask id="utModeration" name="Moderation" activiti:assignee="${moderatorId}"></userTask>
    <sequenceFlow id="lockPassedFlow" name="Locked" sourceRef="IsCourseMarkLocked" targetRef="utModeration">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${locked.equals("true")}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="utLocalFailDebug" name="Debug Lock Failed" activiti:assignee="${admin}"></userTask>
    <sequenceFlow id="lockFailedFlow" name="Locking failed" sourceRef="IsCourseMarkLocked" targetRef="utLocalFailDebug"></sequenceFlow>
    <sequenceFlow id="relockAfterFailedFlow" name="Relock After Locking Failed Flow" sourceRef="utLocalFailDebug" targetRef="stLockCourseMarks"></sequenceFlow>
    <serviceTask id="stUnlockCourseMarks" name="Unlock Course Marks" activiti:class="org.bcaa.sms.service.workflow.delegate.UnlockCourseMarks"></serviceTask>
    <userTask id="utAdjustMarks" name="Adjust Marks" activiti:assignee="${submitterId}"></userTask>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway" default="unlockFailedFlow"></exclusiveGateway>
    <sequenceFlow id="flow4" sourceRef="stUnlockCourseMarks" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow5" sourceRef="utAdjustMarks" targetRef="stLockCourseMarks"></sequenceFlow>
    <sequenceFlow id="unlockPassedFlow" name="Unlock Passed Flow" sourceRef="exclusivegateway1" targetRef="utAdjustMarks">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${locked.equals("false")}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="utDebugUnlockFailed" name="Debug Unlock Failed" activiti:assignee="${admin}"></userTask>
    <sequenceFlow id="unlockFailedFlow" name="Unlock Failed Flow" sourceRef="exclusivegateway1" targetRef="utDebugUnlockFailed"></sequenceFlow>
    <sequenceFlow id="flow7" sourceRef="utDebugUnlockFailed" targetRef="stUnlockCourseMarks"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway" default="moderationRejectFlow"></exclusiveGateway>
    <sequenceFlow id="flow8" sourceRef="utModeration" targetRef="exclusivegateway2"></sequenceFlow>
    <sequenceFlow id="moderationRejectFlow" name="Reject Flow" sourceRef="exclusivegateway2" targetRef="stUnlockCourseMarks"></sequenceFlow>
    <userTask id="utApproval" name="Approval" activiti:assignee="${approverId}"></userTask>
    <sequenceFlow id="moderationApprovedFlow" name="Approved Flow" sourceRef="exclusivegateway2" targetRef="utApproval">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approvalStatus.equals("APPROVE")}]]></conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="exclusivegateway3" name="Exclusive Gateway" default="approvalRejectFlow"></exclusiveGateway>
    <sequenceFlow id="flow10" sourceRef="utApproval" targetRef="exclusivegateway3"></sequenceFlow>
    <sequenceFlow id="approvalRejectFlow" name="Reject Flow" sourceRef="exclusivegateway3" targetRef="stUnlockCourseMarks"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="approvalApprovedFlow" name="Approved Flow" sourceRef="exclusivegateway3" targetRef="endevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approvalStatus.equals("APPROVE")}]]></conditionExpression>
    </sequenceFlow>
    <serviceTask id="stUnlockCourseMarksForInvalidate" name="Unlock Course Marks For Invalidate" activiti:class="org.bcaa.sms.service.workflow.delegate.UnlockCourseMarks"></serviceTask>
    <sequenceFlow id="flow13" sourceRef="exclusivegateway2" targetRef="stUnlockCourseMarksForInvalidate">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approvalStatus.equals("INVALIDATED")}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow14" sourceRef="exclusivegateway3" targetRef="stUnlockCourseMarksForInvalidate">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approvalStatus.equals("INVALIDATED")}]]></conditionExpression>
    </sequenceFlow>
    <endEvent id="terminateendevent1" name="TerminateEndEvent">
      <terminateEventDefinition></terminateEventDefinition>
    </endEvent>
    <sequenceFlow id="flow15" sourceRef="stUnlockCourseMarksForInvalidate" targetRef="terminateendevent1"></sequenceFlow>
    <sequenceFlow id="flow16" sourceRef="IsCourseMarkLocked" targetRef="stUnlockCourseMarksForInvalidate">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approvalStatus.equals("INVALIDATED")}]]></conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_cma3">
    <bpmndi:BPMNPlane bpmnElement="cma3" id="BPMNPlane_cma3">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="41.0" y="206.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="stLockCourseMarks" id="BPMNShape_stLockCourseMarks">
        <omgdc:Bounds height="61.0" width="105.0" x="160.0" y="193.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="IsCourseMarkLocked" id="BPMNShape_IsCourseMarkLocked">
        <omgdc:Bounds height="40.0" width="40.0" x="340.0" y="203.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="utModeration" id="BPMNShape_utModeration">
        <omgdc:Bounds height="55.0" width="105.0" x="432.0" y="196.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="utLocalFailDebug" id="BPMNShape_utLocalFailDebug">
        <omgdc:Bounds height="71.0" width="105.0" x="308.0" y="30.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="stUnlockCourseMarks" id="BPMNShape_stUnlockCourseMarks">
        <omgdc:Bounds height="71.0" width="105.0" x="536.0" y="312.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="utAdjustMarks" id="BPMNShape_utAdjustMarks">
        <omgdc:Bounds height="55.0" width="105.0" x="160.0" y="320.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="340.0" y="327.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="utDebugUnlockFailed" id="BPMNShape_utDebugUnlockFailed">
        <omgdc:Bounds height="65.0" width="105.0" x="308.0" y="450.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
        <omgdc:Bounds height="40.0" width="40.0" x="568.0" y="203.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="utApproval" id="BPMNShape_utApproval">
        <omgdc:Bounds height="55.0" width="105.0" x="683.0" y="196.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway3" id="BPMNShape_exclusivegateway3">
        <omgdc:Bounds height="40.0" width="40.0" x="819.0" y="203.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="1000.0" y="206.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="stUnlockCourseMarksForInvalidate" id="BPMNShape_stUnlockCourseMarksForInvalidate">
        <omgdc:Bounds height="71.0" width="105.0" x="787.0" y="10.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="terminateendevent1" id="BPMNShape_terminateendevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="1000.0" y="28.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="76.0" y="223.0"></omgdi:waypoint>
        <omgdi:waypoint x="160.0" y="223.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="265.0" y="223.0"></omgdi:waypoint>
        <omgdi:waypoint x="340.0" y="223.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="lockPassedFlow" id="BPMNEdge_lockPassedFlow">
        <omgdi:waypoint x="380.0" y="223.0"></omgdi:waypoint>
        <omgdi:waypoint x="432.0" y="223.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="16.0" width="42.0" x="379.0" y="223.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="lockFailedFlow" id="BPMNEdge_lockFailedFlow">
        <omgdi:waypoint x="360.0" y="203.0"></omgdi:waypoint>
        <omgdi:waypoint x="360.0" y="101.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="48.0" width="66.0" x="360.0" y="182.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="relockAfterFailedFlow" id="BPMNEdge_relockAfterFailedFlow">
        <omgdi:waypoint x="308.0" y="65.0"></omgdi:waypoint>
        <omgdi:waypoint x="212.0" y="65.0"></omgdi:waypoint>
        <omgdi:waypoint x="212.0" y="193.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="48.0" width="100.0" x="218.0" y="68.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="536.0" y="347.0"></omgdi:waypoint>
        <omgdi:waypoint x="380.0" y="347.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="212.0" y="320.0"></omgdi:waypoint>
        <omgdi:waypoint x="212.0" y="254.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="unlockPassedFlow" id="BPMNEdge_unlockPassedFlow">
        <omgdi:waypoint x="340.0" y="347.0"></omgdi:waypoint>
        <omgdi:waypoint x="265.0" y="347.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="48.0" width="100.0" x="265.0" y="352.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="unlockFailedFlow" id="BPMNEdge_unlockFailedFlow">
        <omgdi:waypoint x="360.0" y="367.0"></omgdi:waypoint>
        <omgdi:waypoint x="360.0" y="450.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="48.0" width="90.0" x="365.0" y="381.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="413.0" y="482.0"></omgdi:waypoint>
        <omgdi:waypoint x="588.0" y="482.0"></omgdi:waypoint>
        <omgdi:waypoint x="588.0" y="382.0"></omgdi:waypoint>
        <omgdi:waypoint x="641.0" y="347.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="537.0" y="223.0"></omgdi:waypoint>
        <omgdi:waypoint x="568.0" y="223.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="moderationRejectFlow" id="BPMNEdge_moderationRejectFlow">
        <omgdi:waypoint x="588.0" y="243.0"></omgdi:waypoint>
        <omgdi:waypoint x="588.0" y="312.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="48.0" width="57.0" x="590.0" y="265.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="moderationApprovedFlow" id="BPMNEdge_moderationApprovedFlow">
        <omgdi:waypoint x="608.0" y="223.0"></omgdi:waypoint>
        <omgdi:waypoint x="683.0" y="223.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="16.0" width="84.0" x="599.0" y="229.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="788.0" y="223.0"></omgdi:waypoint>
        <omgdi:waypoint x="819.0" y="223.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="approvalRejectFlow" id="BPMNEdge_approvalRejectFlow">
        <omgdi:waypoint x="839.0" y="243.0"></omgdi:waypoint>
        <omgdi:waypoint x="841.0" y="347.0"></omgdi:waypoint>
        <omgdi:waypoint x="641.0" y="347.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="48.0" width="57.0" x="749.0" y="319.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="approvalApprovedFlow" id="BPMNEdge_approvalApprovedFlow">
        <omgdi:waypoint x="859.0" y="223.0"></omgdi:waypoint>
        <omgdi:waypoint x="1000.0" y="223.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="16.0" width="84.0" x="859.0" y="223.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow13" id="BPMNEdge_flow13">
        <omgdi:waypoint x="588.0" y="203.0"></omgdi:waypoint>
        <omgdi:waypoint x="588.0" y="47.0"></omgdi:waypoint>
        <omgdi:waypoint x="787.0" y="45.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow14" id="BPMNEdge_flow14">
        <omgdi:waypoint x="839.0" y="203.0"></omgdi:waypoint>
        <omgdi:waypoint x="839.0" y="81.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow15" id="BPMNEdge_flow15">
        <omgdi:waypoint x="892.0" y="45.0"></omgdi:waypoint>
        <omgdi:waypoint x="1000.0" y="45.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow16" id="BPMNEdge_flow16">
        <omgdi:waypoint x="360.0" y="203.0"></omgdi:waypoint>
        <omgdi:waypoint x="360.0" y="149.0"></omgdi:waypoint>
        <omgdi:waypoint x="589.0" y="149.0"></omgdi:waypoint>
        <omgdi:waypoint x="589.0" y="45.0"></omgdi:waypoint>
        <omgdi:waypoint x="787.0" y="45.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

下面是尝试完成utModeration UserTask的方法。然而,我在这里遇到了回滚

@Transactional(readOnly = false, propagation=Propagation.REQUIRED)
    public List<String> approveCourseMarks(CourseMarksApprovalDto dto, AppUser auser) 
    throws SmsException {

        if (dto == null) throw new SmsException("No approval received","Invalid Approval");
        List<String> errors = new ArrayList<String>();

        if (dto == null || dto.getTaskId() == null) throw new SmsException("No task information received. Unable to proceed.","Invalid Task");
        System.out.println("=== dto="+dto);
        Task task = wfTaskService.createTaskQuery()
                        .taskId(dto.getTaskId())
                        .active()
                        .singleResult();

        if (task == null) {
            errors.add("Course " + dto.getCourse().getFullname() 
                                 + " workflow task is not available to processing. It may already been approved/rejected.");
        }

            Map<String, Object> localVars = new HashMap<String,Object>();

            localVars.put(CourseMarksWorkflowService.VAR_REMARKS, dto.getRemarks());
            localVars.put(CourseMarksWorkflowService.CONDITION_APPROVAL_STATUS, dto.getApprovalStatus());
            localVars.put(CourseMarksWorkflowService.VAR_ACTUAL_AO_ID, auser.getId());
            wfTaskService.setVariablesLocal(task.getId(), localVars);
            wfRuntimeService.setVariable(task.getProcessInstanceId(), CourseMarksWorkflowService.CONDITION_APPROVAL_STATUS, dto.getApprovalStatus());

            wfTaskService.complete(task.getId());

        return errors;
    }
@Transactional(readOnly=false,propagation=propagation.REQUIRED)
公共列表approveCourseMarks(CourseMarks ApprovaldTo dto,AppUser auser)
性感受{
如果(dto==null)抛出新的SMSExException(“未收到批准”,“批准无效”);
列表错误=新建ArrayList();
如果(dto==null | | dto.getTaskId()==null)抛出新的SmsException(“未收到任务信息。无法继续。”,“任务无效”);
System.out.println(“==dto=“+dto”);
Task=wfTaskService.createTaskQuery()
.taskId(dto.getTaskId())
.active()
.singleResult();
如果(任务==null){
错误。添加(“课程”+dto.getCourse().getFullname()
+“工作流任务不可处理。它可能已被批准/拒绝。”);
}
Map localVars=new HashMap();
localVars.put(CourseMarksWorkflowService.VAR_备注,dto.get备注());
localVars.put(CourseMarks WorkflowService.CONDITION_APPROVAL_STATUS,dto.getApprovalStatus());
localVars.put(CourseMarks WorkflowService.VAR_ACTUAL_AO_ID,auser.getId());
setVariablesLocal(task.getId(),localVars);
wfRuntimeService.setVariable(task.getProcessInstanceId(),CourseMarksWorkflowService.CONDITION_APPROVAL_STATUS,dto.getApprovalStatus());
wfTaskService.complete(task.getId());
返回错误;
}
以下是我遇到的例外情况:

2019-12-06 21:35:10.328  INFO 24076 --- [nio-8090-exec-3] o.a.e.i.b.d.BpmnDeployer                 : Processing resource D:\project\smsg2\application\sms4\target\classes\processes\Cma5.cma3.png
    2019-12-06 21:35:10.328  INFO 24076 --- [nio-8090-exec-3] o.a.e.i.b.d.BpmnDeployer                 : Processing resource D:\project\smsg2\application\sms4\target\classes\processes\Cma5.bpmn20.xml
    2019-12-06 21:35:22.242 DEBUG 24076 --- [nio-8090-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Resolving exception from handler [public org.springframework.http.ResponseEntity<java.util.List<java.lang.String>> org.bcaa.sms.controller_hal.result.MarksApprovalHalController.approveCourseMarks(org.bcaa.sms.dto.CourseMarksApprovalDto,java.security.Principal) throws org.bcaa.sms.exception.SmsException]: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
    2019-12-06 21:35:22.242 DEBUG 24076 --- [nio-8090-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Resolving exception from handler [public org.springframework.http.ResponseEntity<java.util.List<java.lang.String>> org.bcaa.sms.controller_hal.result.MarksApprovalHalController.approveCourseMarks(org.bcaa.sms.dto.CourseMarksApprovalDto,java.security.Principal) throws org.bcaa.sms.exception.SmsException]: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
    2019-12-06 21:35:22.242 DEBUG 24076 --- [nio-8090-exec-3] .w.s.m.a.ResponseStatusExceptionResolver : Resolving exception from handler [public org.springframework.http.ResponseEntity<java.util.List<java.lang.String>> org.bcaa.sms.controller_hal.result.MarksApprovalHalController.approveCourseMarks(org.bcaa.sms.dto.CourseMarksApprovalDto,java.security.Principal) throws org.bcaa.sms.exception.SmsException]: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
    2019-12-06 21:35:22.243 DEBUG 24076 --- [nio-8090-exec-3] .w.s.m.s.DefaultHandlerExceptionResolver : Resolving exception from handler [public org.springframework.http.ResponseEntity<java.util.List<java.lang.String>> org.bcaa.sms.controller_hal.result.MarksApprovalHalController.approveCourseMarks(org.bcaa.sms.dto.CourseMarksApprovalDto,java.security.Principal) throws org.bcaa.sms.exception.SmsException]: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
    2019-12-06 21:35:22.243 DEBUG 24076 --- [nio-8090-exec-3] o.s.w.s.DispatcherServlet                : Could not complete request

    org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
        at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:526) ~[spring-orm-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761) ~[spring-tx-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730) ~[spring-tx-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:518) ~[spring-tx-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:292) ~[spring-tx-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) ~[spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.bcaa.sms.service.result.MarksApprovalService$$EnhancerBySpringCGLIB$$23b0f39d.approveCourseMarks(<generated>) ~[classes/:?]
        at org.bcaa.sms.controller_hal.result.MarksApprovalHalController.approveCourseMarks(MarksApprovalHalController.java:113) ~[classes/:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_172]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_172]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_172]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_172]
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) [tomcat-embed-core-8.5.27.jar:8.5.27]
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [tomcat-embed-core-8.5.27.jar:8.5.27]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-8.5.27.jar:8.5.27]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.27.jar:8.5.27]
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.27.jar:8.5.27]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.27.jar:8.5.27]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.27.jar:8.5.27]
        at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.27.jar:8.5.27]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.27.jar:8.5.27]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        ... 105 more

    2019-12-06 21:35:22.260 ERROR 24076 --- [nio-8090-exec-3] o.a.c.c.C.[.[.[.[dispatcherServlet]      : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly] with root cause

    javax.persistence.RollbackException: Transaction marked as rollbackOnly
        at org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:58) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
        at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517) ~[spring-orm-4.3.14.RELEASE.jar:4.3.14.RELEASE]

2019-12-06 21:35:10.328信息24076---[nio-8090-exec-3]o.a.e.i.b.d.BpmnDeployer:处理资源d:\project\smsg2\application\sms4\target\classes\processs\Cma5.cma3.png
2019-12-06 21:35:10.328信息24076---[nio-8090-exec-3]o.a.e.i.b.d.BpmnDeployer:处理资源d:\project\smsg2\application\sms4\target\classes\processs\Cma5.bpmn20.xml
2019-12-06 21:35:22.242调试24076---[nio-8090-exec-3].m.a.ExceptionHandlerExceptionResolver:从处理程序解析异常[public org.springframework.http.ResponseEntity org.bcaa.sms.controller_hal.result.marksaprovalcontroller.approveCourseMarks(org.bcaa.sms.dto.CourseMarks Approvaldto,java.security.Principal)抛出org.bcaa.sms.exception.SmsException]:org.springframework.transaction.TransactionSystemException:无法提交JPA事务;嵌套异常为javax.persistence.RollbackException:标记为rollbackOnly的事务
2019-12-06 21:35:22.242调试24076---[nio-8090-exec-3].m.a.ExceptionHandlerExceptionResolver:从处理程序解析异常[public org.springframework.http.ResponseEntity org.bcaa.sms.controller_hal.result.marksaprovalcontroller.approveCourseMarks(org.bcaa.sms.dto.CourseMarks Approvaldto,java.security.Principal)抛出org.bcaa.sms.exception.SmsException]:org.springframework.transaction.TransactionSystemException:无法提交JPA事务;嵌套异常为javax.persistence.RollbackException:标记为rollbackOnly的事务
2019-12-06 21:35:22.242调试24076---[nio-8090-exec-3].w.s.m.a.ResponseStatusExceptionResolver:从处理程序解析异常[public org.springframework.http.ResponseEntity org.bcaa.sms.controller_hal.result.marksaprovalhalcontroller.approveCourseMarks(org.bcaa.sms.dto.CourseMarksApp
@Transactional(readOnly = false, propagation=Propagation.REQUIRES_NEW)