我使用的是Camunda BPMN引擎版本7.17.6-ee和Camunda建模器版本4.6.0
我有一个Camunda流程,它有一个并行多示例子流程,该子流程有两个任务A和B,其中B是一个称为活动的顺序多示例(图中的T表示事务边界)。当子流程完成时,它将继续循环以获取下一个未完成的预订,直到没有未完成的预订。
如果我运行这个流程,我会在子流程中遇到以下错误(更准确地说是在顺序多示例任务B中):
ERROR [org.camunda.bpm.engine.context] (pool-15-thread-13) ENGINE-16004 Exception while closing command context: null: java.util.NoSuchElementException
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:1000)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.getElementAtIndex(MultiInstanceActivityBehavior.java:129)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.evaluateCollectionVariable(MultiInstanceActivityBehavior.java:93)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.performInstance(MultiInstanceActivityBehavior.java:78)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.bpmn.behavior.SequentialMultiInstanceActivityBehavior.complete(SequentialMultiInstanceActivityBehavior.java:58)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityEnd.execute(PvmAtomicOperationActivityEnd.java:105)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityEnd.execute(PvmAtomicOperationActivityEnd.java:35)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:99)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:131)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:111)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:86)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:623)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:597)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityNotifyListenerEnd$1.callback(PvmAtomicOperationActivityNotifyListenerEnd.java:47)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityNotifyListenerEnd$1.callback(PvmAtomicOperationActivityNotifyListenerEnd.java:41)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.continueExecutionIfNotCanceled(PvmExecutionImpl.java:2078)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.dispatchDelayedEventsAndPerformOperation(PvmExecutionImpl.java:2027)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityNotifyListenerEnd.eventNotificationsCompleted(PvmAtomicOperationActivityNotifyListenerEnd.java:41)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityNotifyListenerEnd.eventNotificationsCompleted(PvmAtomicOperationActivityNotifyListenerEnd.java:27)
at org.camunda.bpm.camunda-engine@7.17.0//org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:66)
...
在Camunda的MultiInstanceActivityBehavior
类和以下方法中发生异常:
protected Object getElementAtIndex(int i, Collection<?> collection) {
Object value = null;
int index = 0;
Iterator<?> it = collection.iterator();
while (index <= i) {
value = it.next();
index++;
}
return value;
}
it.next()
抛出异常。
我怀疑这个列表正在被另一个线程并行操作,这就是为什么会出现异常的原因,但显然我错了,因为我尝试了线程安全集合,但没有成功。
有人能帮助我,告诉我我做错了什么,或者过程出了什么问题吗?
1条答案
按热度按时间wwtsj6pe1#
我同意列表在执行过程中可能发生了变化。建议您在
getElementAtIndex(int i, Collection<?> collection)
中设置断点,并检查每次迭代的索引和集合。作为企业版(-ee)的用户,您还可以通过https://jira.camunda.com从Camunda支持部门获得帮助