The workflow suspend at a UserTask. After setting the local and process variables, I tried to TaskService.complete(task.getId()). When leave the method, it Rollback. However, there is no information where I can see what actually causes in the exception.
I am using Spring-boot 1.5.10.RELEASE
Below is a snappet of my maven for activiti:
<dependency>
<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>
This is the bpmn file. I have successfully started a new process, that execute fine for the first 2 "stLockCourseMarks" service task and "IsCourseMarkLocked" exclusive gateway. So it suspend at "Moderation" UserTask:
<?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>
Below is the method that tries to complete the utModeration UserTask. However, i encounter rollback here.
#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;
}
Below is the exception i encounter:
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]
What could be cause of the issue? Thanks.
Managed to solved it; require to change the transaction progration from REQUIRES to REQUIRES_NEW. That is the annotation of the method change to this:
#Transactional(readOnly = false, propagation=Propagation.REQUIRES_NEW)
Do not know exactly why this solve the problem though. If anyone know the reason, will be interested to know.
Related
I am creating two parallel user tasks in Camunda, lets call them Sign and Parallel.
I need Parallel to end when Sign is completed, so I send message that closes Parallel, correlated by process instance id. But process does not continue any further and waits on joining gateway.
Why does this happen? What is process waiting for?
There is no outgoing condition and both incoming flows should be "finished".
AFAIK correct way is for joining gateway to be parallel.
Nothing changes if I set both throwing/catching events as Asynchronous Before/After.
Message correlates, I do not receive any error (as is the case when I use incorrect message name). Message implementation is in expression and seems to run ok.
It is clear it has to do something with message since removing throw/catch events and
completing both tasks manually will move process to Continue task
Here is the whole process:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0ojij3f" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:collaboration id="Collaboration_1ozdkce">
<bpmn:participant id="Participant_03ldfi3" name="parallelTest" processRef="parallelTest" />
</bpmn:collaboration>
<bpmn:process id="parallelTest" name="parallelTest" isExecutable="true">
<bpmn:laneSet id="LaneSet_035464k">
<bpmn:lane id="Lane_0k26mop">
<bpmn:flowNodeRef>Event_1hml6oa</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Gateway_0rkmzqq</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Activity_0paxf52</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Activity_0kdxi53</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Event_0wr8eiq</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Gateway_17aatvo</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Activity_0jj89u4</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Event_17cvwa6</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Event_0et01tn</bpmn:flowNodeRef>
</bpmn:lane>
</bpmn:laneSet>
<bpmn:startEvent id="Event_1hml6oa" name="Start">
<bpmn:outgoing>Flow_1wdtypj</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:parallelGateway id="Gateway_0rkmzqq">
<bpmn:incoming>Flow_1wdtypj</bpmn:incoming>
<bpmn:outgoing>Flow_086eue3</bpmn:outgoing>
<bpmn:outgoing>Flow_1v8wqr7</bpmn:outgoing>
</bpmn:parallelGateway>
<bpmn:userTask id="Activity_0paxf52" name="Sign">
<bpmn:incoming>Flow_086eue3</bpmn:incoming>
<bpmn:outgoing>Flow_1xnm82g</bpmn:outgoing>
</bpmn:userTask>
<bpmn:userTask id="Activity_0kdxi53" name="Parallel">
<bpmn:incoming>Flow_1v8wqr7</bpmn:incoming>
<bpmn:outgoing>Flow_10mh6j0</bpmn:outgoing>
</bpmn:userTask>
<bpmn:intermediateThrowEvent id="Event_0wr8eiq" name="Send message" camunda:asyncBefore="true" camunda:asyncAfter="true">
<bpmn:incoming>Flow_1xnm82g</bpmn:incoming>
<bpmn:outgoing>Flow_1quitqe</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_14h1b1s" messageRef="Message_1u77676" camunda:expression="${execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation("Signed").processInstanceId(execution.getProcessInstanceId()).correlateWithResult()}" />
</bpmn:intermediateThrowEvent>
<bpmn:parallelGateway id="Gateway_17aatvo">
<bpmn:incoming>Flow_1quitqe</bpmn:incoming>
<bpmn:incoming>Flow_10mh6j0</bpmn:incoming>
<bpmn:outgoing>Flow_12v8new</bpmn:outgoing>
</bpmn:parallelGateway>
<bpmn:userTask id="Activity_0jj89u4" name="Continue">
<bpmn:incoming>Flow_12v8new</bpmn:incoming>
<bpmn:outgoing>Flow_1wd9ipe</bpmn:outgoing>
</bpmn:userTask>
<bpmn:endEvent id="Event_17cvwa6" name="End">
<bpmn:incoming>Flow_1wd9ipe</bpmn:incoming>
</bpmn:endEvent>
<bpmn:boundaryEvent id="Event_0et01tn" camunda:asyncBefore="true" camunda:asyncAfter="true" attachedToRef="Activity_0kdxi53">
<bpmn:messageEventDefinition id="MessageEventDefinition_0men7xp" messageRef="Message_1u77676" />
</bpmn:boundaryEvent>
<bpmn:sequenceFlow id="Flow_1wdtypj" sourceRef="Event_1hml6oa" targetRef="Gateway_0rkmzqq" />
<bpmn:sequenceFlow id="Flow_10mh6j0" sourceRef="Activity_0kdxi53" targetRef="Gateway_17aatvo" />
<bpmn:sequenceFlow id="Flow_1quitqe" sourceRef="Event_0wr8eiq" targetRef="Gateway_17aatvo" />
<bpmn:sequenceFlow id="Flow_086eue3" sourceRef="Gateway_0rkmzqq" targetRef="Activity_0paxf52" />
<bpmn:sequenceFlow id="Flow_1xnm82g" sourceRef="Activity_0paxf52" targetRef="Event_0wr8eiq" />
<bpmn:sequenceFlow id="Flow_12v8new" sourceRef="Gateway_17aatvo" targetRef="Activity_0jj89u4" />
<bpmn:sequenceFlow id="Flow_1wd9ipe" sourceRef="Activity_0jj89u4" targetRef="Event_17cvwa6" />
<bpmn:sequenceFlow id="Flow_1v8wqr7" sourceRef="Gateway_0rkmzqq" targetRef="Activity_0kdxi53" />
</bpmn:process>
<bpmn:signal id="Signal_2pm9l20" name="Signál12" />
<bpmn:signal id="Signal_0lh8jlk" name="Signal_0lh8jlk" />
<bpmn:message id="Message_3enu7h8" name="Message_3enu7h8" />
<bpmn:signal id="Signal_1papr4s" name="Signal_1papr4s" />
<bpmn:signal id="Signal_0n33km6" name="Signal_0n33km6" />
<bpmn:signal id="Signal_0a40rpa" name="Signal_0a40rpa" />
<bpmn:message id="Message_1u77676" name="Signed" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1ozdkce">
<bpmndi:BPMNShape id="Participant_03ldfi3_di" bpmnElement="Participant_03ldfi3" isHorizontal="true">
<dc:Bounds x="160" y="80" width="740" height="330" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_0k26mop_di" bpmnElement="Lane_0k26mop" isHorizontal="true">
<dc:Bounds x="190" y="80" width="710" height="330" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1v8wqr7_di" bpmnElement="Flow_1v8wqr7">
<di:waypoint x="340" y="215" />
<di:waypoint x="340" y="180" />
<di:waypoint x="400" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1wd9ipe_di" bpmnElement="Flow_1wd9ipe">
<di:waypoint x="810" y="250" />
<di:waypoint x="842" y="250" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_12v8new_di" bpmnElement="Flow_12v8new">
<di:waypoint x="665" y="250" />
<di:waypoint x="710" y="250" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1xnm82g_di" bpmnElement="Flow_1xnm82g">
<di:waypoint x="500" y="300" />
<di:waypoint x="522" y="300" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_086eue3_di" bpmnElement="Flow_086eue3">
<di:waypoint x="340" y="265" />
<di:waypoint x="340" y="300" />
<di:waypoint x="400" y="300" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1quitqe_di" bpmnElement="Flow_1quitqe">
<di:waypoint x="558" y="300" />
<di:waypoint x="640" y="300" />
<di:waypoint x="640" y="275" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_10mh6j0_di" bpmnElement="Flow_10mh6j0">
<di:waypoint x="500" y="180" />
<di:waypoint x="640" y="180" />
<di:waypoint x="640" y="225" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1wdtypj_di" bpmnElement="Flow_1wdtypj">
<di:waypoint x="268" y="240" />
<di:waypoint x="315" y="240" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_195kvod_di" bpmnElement="Event_1hml6oa">
<dc:Bounds x="232" y="222" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="238" y="265" width="25" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_1eubz1s_di" bpmnElement="Gateway_0rkmzqq">
<dc:Bounds x="315" y="215" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_07l0l1t_di" bpmnElement="Activity_0paxf52">
<dc:Bounds x="400" y="260" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1y3uzxd_di" bpmnElement="Activity_0kdxi53">
<dc:Bounds x="400" y="140" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0yo6m1f_di" bpmnElement="Event_0wr8eiq">
<dc:Bounds x="522" y="282" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="548" y="269" width="74" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_1nbx3kv_di" bpmnElement="Gateway_17aatvo">
<dc:Bounds x="615" y="225" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_09jpbyc_di" bpmnElement="Activity_0jj89u4">
<dc:Bounds x="710" y="210" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_17cvwa6_di" bpmnElement="Event_17cvwa6">
<dc:Bounds x="842" y="232" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="850" y="275" width="20" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1kbtuoe_di" bpmnElement="Event_0et01tn">
<dc:Bounds x="482" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Composite writer
<bean id="compositeItemWriter" class="org.springframework.batch.item.support.CompositeItemWriter">
<property name="delegates">
<list>
<ref bean="writer1" />
<ref bean="writer2" />
</list>
</property>
</bean>
#Writer1
<bean id="writer1" class="......TableWriter">
<property name="assertUpdates" value="false" />
<property name="itemPreparedStatementSetter">
<!-- Our Mapper for table writer -->
<bean class="......WriterTableMapper" />
</property>
<!-- Put in your INSERT, UPDATE, DELETE SQL here -->
<property name="sql" value="dummy" />
<property name="dataSource" ref="dataSource" />
</bean>
Dummy SQL set in the ...TableWriter class in beforeWrite method
#Override
public void beforeWrite(List< ? extends bo > items) {
StringBuilder sb = new StringBuilder( );
if ( "DELETE".equals( NAME ) ) {
sb.append( " DELETE FROM table1 WHERE abc = ?" );
} else {
log.error( "Invalid sql [{}]", name );
}
setSql( sb.toString( ) );
}
*My Question is I have error when call
compositeWriter
but no error when directly call
writer1
*
Chunk
<chunk reader="reader" writer="compositeWriter/writer1" commit-interval="10" />
ERROR
`2016-02-26 18:08:55,606 ERROR | main | org.springframework.batch.core.step.AbstractStep | Encountered an error executing step migrateFutureDated in job job-futuredated
org.springframework.retry.ExhaustedRetryException: Retry exhausted after last attempt in recovery path, but exception is not skippable.; nested exception is org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [dummy]; nested exception is com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][10145][10844][4.17.29] Invalid parameter 1: Parameter index is out of range. ERRORCODE=-4461, SQLSTATE=42815
at org.springframework.batch.core.step.item.FaultTolerantChunkProcessor$5.recover(FaultTolerantChunkProcessor.java:403) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.retry.support.RetryTemplate.handleRetryExhausted(RetryTemplate.java:458) ~[spring-retry-1.1.0.RELEASE.jar:na]
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:320) ~[spring-retry-1.1.0.RELEASE.jar:na]
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:193) ~[spring-retry-1.1.0.RELEASE.jar:na]
at org.springframework.batch.core.step.item.BatchRetryTemplate.execute(BatchRetryTemplate.java:217) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.step.item.FaultTolerantChunkProcessor.write(FaultTolerantChunkProcessor.java:420) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:199) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:368) ~[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) ~[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144) ~[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:198) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148) [spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64) [spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67) [spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:165) [spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144) [spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:134) [spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:304) [spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135) [spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) [spring-core-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:128) [spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [dummy]; nested exception is com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][10145][10844][4.17.29] Invalid parameter 1: Parameter index is out of range. ERRORCODE=-4461, SQLSTATE=42815
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:94) ~[spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:602) ~[spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:614) ~[spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.item.database.JdbcBatchItemWriter.write(JdbcBatchItemWriter.java:185) ~[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at ......CompositeItemWriter.write(CompositeItemWriter.java:100) ~[bin/:na]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.core.step.item.FaultTolerantChunkProcessor$3.doWithRetry(FaultTolerantChunkProcessor.java:328) ~[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263) ~[spring-retry-1.1.0.RELEASE.jar:na]
... 28 common frames omitted
Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][10145][10844][4.17.29] Invalid parameter 1: Parameter index is out of range. ERRORCODE=-4461, SQLSTATE=42815
at com.ibm.db2.jcc.am.hd.a(hd.java:747) ~[db2jcc4-10.5.0.3.jar:na]
at com.ibm.db2.jcc.am.hd.a(hd.java:66) ~[db2jcc4-10.5.0.3.jar:na]
at com.ibm.db2.jcc.am.hd.a(hd.java:111) ~[db2jcc4-10.5.0.3.jar:na]
at com.ibm.db2.jcc.am.xo.l(xo.java:5987) ~[db2jcc4-10.5.0.3.jar:na]
at com.ibm.db2.jcc.am.xo.j(xo.java:5942) ~[db2jcc4-10.5.0.3.jar:na]
at com.ibm.db2.jcc.am.xo.a(xo.java:1606) ~[db2jcc4-10.5.0.3.jar:na]
at com.ibm.db2.jcc.am.xo.setString(xo.java:1595) ~[db2jcc4-10.5.0.3.jar:na]
at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:135) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:135) ~[commons-dbcp-1.4.jar:1.4]
at .....WriterTableMapper.setValues(..WriterTableMapper.java:22) ~[bin/:na]
at .....WriterTableMapper.setValues(..WriterTableMapper.java:1) ~[bin/:na]
at org.springframework.batch.item.database.JdbcBatchItemWriter$1.doInPreparedStatement(JdbcBatchItemWriter.java:189) ~[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.batch.item.database.JdbcBatchItemWriter$1.doInPreparedStatement(JdbcBatchItemWriter.java:185) ~[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:586) ~[spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]
I am using spring integration's ftp down loader to download the files in the local directory. after sometimes it gives me the below error.
<bean id="ftpSessionFactory"
class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<property name="host" value="${ftp.host}" />
<property name="port" value="$ftp.port}" />
<property name="username" value="${ftp.user}" />
<property name="password" value="${ftp.password}" />
<property name="clientMode" value="2" />
<property name="fileType" value="2" />
<property name="bufferSize" value="100000" />
</bean>
<int-ftp:inbound-channel-adapter id="ftpInbound"
channel="nullChannel"
session-factory="ftpSessionFactory"
charset="UTF-8"
delete-remote-files="false"
remote-directory="${ftp.remotedir}"
preserve-timestamp="true"
auto-create-local-directory="true"
local-directory="${ftp.localdir}"
filter="remoteFileListFilter"
temporary-file-suffix=".writing">
<int:poller fixed-rate="1000" />
</int-ftp:inbound-channel-adapter>
</beans>
error is :
ERROR 2015-07-28 01:41:43,426 [task-scheduler-1][] org.springframework.integration.handler.LoggingHandler - org.springframework.messaging.MessagingException: Problem occurred while synchronizing remote to local directory
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:193)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.receive(AbstractInboundFileSynchronizingMessageSource.java:167)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:124)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:190)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:55)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:149)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:284)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:278)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.messaging.MessagingException: Failed to execute on session
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:311)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:167)
... 20 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:196)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:154)
at java.io.BufferedReader.readLine(BufferedReader.java:317)
at java.io.BufferedReader.readLine(BufferedReader.java:382)
at org.apache.commons.net.ftp.FTPFileEntryParserImpl.readNextEntry(FTPFileEntryParserImpl.java:53)
at org.apache.commons.net.ftp.FTPListParseEngine.readStream(FTPListParseEngine.java:128)
at org.apache.commons.net.ftp.FTPListParseEngine.readServerList(FTPListParseEngine.java:104)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3302)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3271)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2930)
at org.springframework.integration.ftp.session.FtpSession.list(FtpSession.java:68)
at org.springframework.integration.ftp.session.FtpSession.list(FtpSession.java:41)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer$1.doInSession(AbstractInboundFileSynchronizer.java:171)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer$1.doInSession(AbstractInboundFileSynchronizer.java:167)
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:302)
Caused by: java.net.SocketException: Connection reset
It just means the server closed the connection - look at the server logs.
I've been developing maven java spring 3.1 program and deploy it on jetty. It ran successfully on jetty. And now I need to deploy it on weblogic 10.3.4 but I always get this BeanDefinitionParserDelegate error. Is there anything (like library or class) I should add to weblogic environment to get it work?
Here are my error stack trace:
951 [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)']
ERROR o.s.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring/spring-security.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.getLocalName(Lorg/w3c/dom/Node;)Ljava/lang/String;
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:375) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:298) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:241) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) [spring-2.0.3.jar:2.0.3]
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481) [weblogic.jar:10.3.4.0]
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) [com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1]
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) [com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0]
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181) [weblogic.jar:10.3.4.0]
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1872) [weblogic.jar:10.3.4.0]
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153) [weblogic.jar:10.3.4.0]
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508) [weblogic.jar:10.3.4.0]
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425) [weblogic.jar:10.3.4.0]
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425) [weblogic.jar:10.3.4.0]
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636) [weblogic.jar:10.3.4.0]
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43) [weblogic.jar:10.3.4.0]
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161) [weblogic.jar:10.3.4.0]
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79) [weblogic.jar:10.3.4.0]
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569) [weblogic.jar:10.3.4.0]
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150) [weblogic.jar:10.3.4.0]
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116) [weblogic.jar:10.3.4.0]
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323) [weblogic.jar:10.3.4.0]
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844) [weblogic.jar:10.3.4.0]
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253) [weblogic.jar:10.3.4.0]
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440) [weblogic.jar:10.3.4.0]
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163) [weblogic.jar:10.3.4.0]
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195) [weblogic.jar:10.3.4.0]
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13) [weblogic.jar:10.3.4.0]
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68) [weblogic.jar:10.3.4.0]
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528) [com.bea.core.weblogic.workmanager_1.9.0.0.jar:1.9.0.0]
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207) [com.bea.core.weblogic.workmanager_1.9.0.0.jar:1.9.0.0]
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176) [com.bea.core.weblogic.workmanager_1.9.0.0.jar:1.9.0.0]
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.getLocalName(Lorg/w3c/dom/Node;)Ljava/lang/String;
at org.springframework.security.config.SecurityNamespaceHandler.parse(SecurityNamespaceHandler.java:69) ~[spring-security-config-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1114) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1104) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:133) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:458) ~[spring-2.0.3.jar:2.0.3]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:353) ~[spring-2.0.3.jar:2.0.3]
... 48 common frames omitted
And this is my xml code in spring-security.xml
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<global-method-security pre-post-annotations="enabled" />
<beans:bean id="customAuthFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
<beans:property name="sessionAuthenticationStrategy" ref="sas"/>
<beans:property name="authenticationManager" ref="authenticationManager" />
<beans:property name="allowSessionCreation" value="true" />
</beans:bean>
<beans:bean id="sas" class="org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy">
<beans:constructor-arg name="sessionRegistry" ref="sessionRegistry"/>
<beans:property name="maximumSessions" value="1" />
</beans:bean>
<beans:bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl" />
<beans:bean id="loginService" class="com.pusilkom.artajasa.billing.service.LoginService" />
<beans:bean id="customAuthenticationProvider" class="com.pusilkom.artajasa.billing.util.ArtajasaAuthenticationProvider" />
<authentication-manager alias="authenticationManager">
<authentication-provider ref="customAuthenticationProvider" />
</authentication-manager>
<beans:bean id="accessDeniedHandler" class="com.pusilkom.artajasa.billing.util.ThouShaltNoPass">
<beans:property name="accessDeniedURL" value="/session/403/" />
</beans:bean>
Anyone can help?
Your logs show that you have Spring 2.0.3 on your classpath, you need to have atleast Spring 3.0.6 to work with Spring Security 3.1.x. So try cleaning your classpath or check if the jar is being included from other projects.
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1114) ~[spring-2.0.3.jar:2.0.3]
Have you tried to use the prefer-web-inf-classes element? In WEB-INF/weblogic.xml (next to web.xml)
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
http://www.bea.com/ns/weblogic/90/weblogic- web-app.xsd">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
See: Weblogic 10.3.1.0 is using com.bea.core.apache.commons.net_1.0.0.0_1-4-1.jar... I want to use commons-net-2.0.jar from my code
I have a really weird exception being thrown that's extremely frustrating to track down. This behavior started when I switched from Hibernate to Eclipselink to satisfy a need for a missing feature.
This seems like some kind of communication miss between Spring and Eclipselink to me, but it may also be a configuration miss on my part. Can you help me figure this out? I'm pulling my hair out over what is probably something very simple.
Any help would be greatly appreciated!
org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction#4a73d6bb targetAction = [EvaluateAction#7b16b52c expression = companyDao.listAll(), resultExpression = flowScope.entityList], attributes = map[[empty]]] in state 'null' of flow 'flows/company/list' -- action execution attributes were 'map[[empty]]'
org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:60)
org.springframework.webflow.engine.ActionList.execute(ActionList.java:155)
org.springframework.webflow.engine.Flow.start(Flow.java:534)
org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:366)
org.springframework.webflow.engine.impl.RequestControlContextImpl.start(RequestControlContextImpl.java:234)
org.springframework.webflow.engine.SubflowState.doEnter(SubflowState.java:101)
org.springframework.webflow.engine.State.enter(State.java:194)
org.springframework.webflow.engine.Transition.execute(Transition.java:227)
org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:393)
org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
org.springframework.webflow.engine.TransitionableState.handleEvent(TransitionableState.java:119)
org.springframework.webflow.engine.Flow.handleEvent(Flow.java:555)
org.springframework.webflow.engine.impl.FlowExecutionImpl.handleEvent(FlowExecutionImpl.java:388)
org.springframework.webflow.engine.impl.RequestControlContextImpl.handleEvent(RequestControlContextImpl.java:210)
org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:232)
org.springframework.webflow.engine.ViewState.resume(ViewState.java:196)
org.springframework.webflow.engine.Flow.resume(Flow.java:545)
org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:261)
org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:48)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...
org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction rolled back because transaction was set to RollbackOnly.
org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:476)
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
mypackage.GenericDAOImpl$$EnhancerByCGLIB$$945581be.listAll(<generated>)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:69)
org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:110)
org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:57)
org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102)
org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:97)
org.springframework.binding.expression.spel.SpringELExpression.getValue(SpringELExpression.java:84)
org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:75)
org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
org.springframework.webflow.engine.ActionList.execute(ActionList.java:155)
org.springframework.webflow.engine.Flow.start(Flow.java:534)
org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:366)
org.springframework.webflow.engine.impl.RequestControlContextImpl.start(RequestControlContextImpl.java:234)
org.springframework.webflow.engine.SubflowState.doEnter(SubflowState.java:101)
org.springframework.webflow.engine.State.enter(State.java:194)
org.springframework.webflow.engine.Transition.execute(Transition.java:227)
org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:393)
org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
org.springframework.webflow.engine.TransitionableState.handleEvent(TransitionableState.java:119)
org.springframework.webflow.engine.Flow.handleEvent(Flow.java:555)
org.springframework.webflow.engine.impl.FlowExecutionImpl.handleEvent(FlowExecutionImpl.java:388)
org.springframework.webflow.engine.impl.RequestControlContextImpl.handleEvent(RequestControlContextImpl.java:210)
org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:232)
org.springframework.webflow.engine.ViewState.resume(ViewState.java:196)
org.springframework.webflow.engine.Flow.resume(Flow.java:545)
org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:261)
org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:48)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:96)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
javax.persistence.RollbackException: Transaction rolled back because transaction was set to RollbackOnly.
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:92)
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:467)
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
mypackage.GenericDAOImpl$$EnhancerByCGLIB$$945581be.listAll(<generated>)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:69)
org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:110)
org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:57)
org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102)
org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:97)
org.springframework.binding.expression.spel.SpringELExpression.getValue(SpringELExpression.java:84)
org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:75)
org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
org.springframework.webflow.engine.ActionList.execute(ActionList.java:155)
org.springframework.webflow.engine.Flow.start(Flow.java:534)
org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:366)
org.springframework.webflow.engine.impl.RequestControlContextImpl.start(RequestControlContextImpl.java:234)
org.springframework.webflow.engine.SubflowState.doEnter(SubflowState.java:101)
org.springframework.webflow.engine.State.enter(State.java:194)
org.springframework.webflow.engine.Transition.execute(Transition.java:227)
org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:393)
org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
org.springframework.webflow.engine.TransitionableState.handleEvent(TransitionableState.java:119)
org.springframework.webflow.engine.Flow.handleEvent(Flow.java:555)
org.springframework.webflow.engine.impl.FlowExecutionImpl.handleEvent(FlowExecutionImpl.java:388)
org.springframework.webflow.engine.impl.RequestControlContextImpl.handleEvent(RequestControlContextImpl.java:210)
org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:232)
org.springframework.webflow.engine.ViewState.resume(ViewState.java:196)
org.springframework.webflow.engine.Flow.resume(Flow.java:545)
org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:261)
org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:48)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:96)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
Here's the method in question:
#Override
#Transactional(readOnly = true)
public List<entityType> listAll() {
String entityName = entityClass.getSimpleName();
if (entityClass.isAnnotationPresent(Entity.class)) {
Entity ea = (Entity) entityClass.getAnnotation(Entity.class);
if (ea.name() != null && ea.name().length() > 0) {
entityName = ea.name();
}
// TODO: If this query exists: entityName + ".list", use it, otherwise:
EntityManager em = getEntityManager();
Query query = null;
try {
// Try and find a query with the name (EntityName).list
query = em.createNamedQuery(entityName + ".list");
} catch (IllegalArgumentException ex) {
try {
// No query with this name, so fill it in with a custom query
if (entityClass.getMethod("deletedDate", Date.class) != null) {
query = em.createQuery("SELECT e FROM " + entityName + " e WHERE deletedDate is null");
} else {
throw new NoSuchMethodException();
}
} catch (NoSuchMethodException ex1) {
query = em.createQuery("SELECT e FROM " + entityName + " e");
}
}
return query.getResultList();
}
return null;
}
Spring Config is as follows:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:faces="http://www.springframework.org/schema/faces"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- This will load environmental properties for us as well, filling in
the necessary data for connecting to an in-memory RDB by default,
or another DB if supplied properties by the environment -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<!-- System values take priority -->
<property name="systemPropertiesMode" value="2" />
<!-- Check the properties file if we don't find the value in the environment -->
<property name="locations">
<list>
<value>classpath:/memory-database.properties</value>
</list>
</property>
</bean>
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
<property name="url" value="${JDBC_CONNECTION_STRING}"/>
<property name="username" value="${PARAM1}"/>
<property name="password" value="${PARAM2}"/>
<property name="driverClassName" value="${PARAM3}"/>
<property name="validationQuery" value="${PARAM4}"/>
</bean>
<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
<property name="jpaDialect" ref="jpaDialect"/>
</bean>
<context:annotation-config/>
<!-- Enable aspectj based transactions -->
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager" />
<!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!-- the transactional semantics... -->
<tx:attributes>
<!-- all methods starting with 'get' are read-only -->
<tx:method name="get*" read-only="true"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="refresh*" read-only="true"/>
<tx:method name="list*" read-only="true"/>
<!-- other methods use the default transaction settings (see below) -->
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:pointcut id="DaoOps" expression="execution(* mypackage.GenericDAO.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="DaoOps"/>
</aop:config>
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
<property name="jpaDialect" ref="jpaDialect"/>
</bean>
<bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter" >
<property name="showSql" value="true"/>
<property name="generateDdl" value="true" />
</bean>
<bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect"/>
<import resource="webmvc-config.xml"/>
<import resource="applicationContext-security.xml"/>
</beans>
Persistence.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
... Many Entity Classes Listed Here ...
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.weaving" value="static"/>
</properties>
</persistence-unit>
</persistence>
Static weaving is in fact being done via an ant task from Maven:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-classes</phase>
<configuration>
<tasks>
<java classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeave"
classpathref="maven.runtime.classpath" fork="true">
<arg line="-loglevel FINE -persistenceinfo src/main/resources target/classes target/classes"/>
</java>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Why are you catching runtime exception (IllegalArgumentException ) in transactional method? It will mark spring managed transaction for rollback.
Work around
#Transactional(noRollbackFor=IllegalArgumentException.class)