背景

在开发bpm流程,流程流转到平行审批节点时报错,流程如下:

报错信息如下:

Caused By: java.lang.NullPointerException
        at oracle.bpm.bpmn.engine.model.runtime.microinstructions.MIUserTaskRequest.addTaskAttributesToXml(MIUserTaskRequest.java:568)
        at oracle.bpm.bpmn.engine.model.runtime.microinstructions.MIUserTaskRequest.processInputData(MIUserTaskRequest.java:319)
        at oracle.bpm.bpmn.engine.model.runtime.microinstructions.MIUserTaskRequest.handleTaskServiceInvoke(MIUserTaskRequest.java:158)
        at oracle.bpm.bpmn.engine.model.runtime.microinstructions.MIUserTaskRequest.doExecute(MIUserTaskRequest.java:128)
        at oracle.bpm.bpmn.engine.microkernel.MIBase.execute(MIBase.java:34)
        at oracle.bpm.bpmn.engine.microkernel.MISequenceBlock.doExecute(MISequenceBlock.java:68)
        at oracle.bpm.bpmn.engine.microkernel.MIBase.execute(MIBase.java:34)
        at oracle.bpm.bpmn.engine.microkernel.MicroInstructionContext.callMicroInstruction(MicroInstructionContext.java:203)
        at oracle.bpm.bpmn.engine.microkernel.MICall.doExecute(MICall.java:38)
        at oracle.bpm.bpmn.engine.microkernel.MIBase.execute(MIBase.java:34)
        at oracle.bpm.bpmn.engine.microkernel.MISequenceBlock.doExecute(MISequenceBlock.java:68)
        at oracle.bpm.bpmn.engine.microkernel.MIBase.execute(MIBase.java:34)
        at oracle.bpm.bpmn.engine.microkernel.MicroInstructionContext.callMicroInstruction(MicroInstructionContext.java:203)
        at oracle.bpm.bpmn.engine.microkernel.MicroInstructionContext.callProcedure(MicroInstructionContext.java:210)
.......

流程实例进入Recovery状态,retry问题依旧。

排查

单独把平行审批拿出来流程是可以正常流转,从错误信息中也获取不到其他有用的信息,因为有错误栈,因此决定用arthas进行调试。

  • 获取代码所在的jar包,用sc命令
arthas@30318]$ sc -d oracle.bpm.bpmn.engine.model.runtime.microinstructions.MIUserTaskRequest
 class-info        oracle.bpm.bpmn.engine.model.runtime.microinstructions.MIUserTaskRequest                                                   
 code-source       /u01/Middleware/Oracle/soa/soa/modules/oracle.bpm.runtime_11.1.1/oracle.bpm.runtime.bpmn-engine.jar                        
 name              oracle.bpm.bpmn.engine.model.runtime.microinstructions.MIUserTaskRequest                                                   
 isInterface       false                                                                                                                      
 isAnnotation      false                                                                                                                      
 isEnum            false                                                                                                                      
 isAnonymousClass  false                                                                                                                      
 isArray           false                                                                                                                      
 isLocalClass      false                                                                                                                      
 isMemberClass     false                                                                                                                      
 isPrimitive       false                                                                                                                      
 isSynthetic       false                                                                                                                      
 simple-name       MIUserTaskRequest                                                                                                          
 modifier          public                                                                                                                     
 annotation                                                                                                                                   
 interfaces

其中 code-source /u01/Middleware/Oracle/soa/soa/modules/oracle.bpm.runtime_11.1.1/oracle.bpm.runtime.bpmn-engine.jar就是jar包路径,下载jar包

– 查看源码,根据错误栈找到出错代码位置

根据代码逻辑, Lane lane = userTask.getLane();这行代码获取到空到Lane导致调用时空指针异常,Lane在bpm中代表泳道,应该是这个userTask找不到泳道报错了,看了下流程图,确实跑到泳道外了,把泳道加宽问题解决。

总结

问题虽小,但通过google和support也没有找到合适的解决方案,通过arthas一下子就知道问题所在。

你可以有疑问,流程建模如果节点跑到泳道外,jdeveloper是会报错的,那为什么流程还能部署上去?因为这个流程是我用代码生成的。
Trackback

no comment untill now

Add your comment now