bpmn - 创建部署时出错 => ENGINE-16004 关闭命令上下文时出现异常:null
问题描述
异常的完整堆栈跟踪如下,
2021-02-11 16:28:52.475 [NBIN0060] [http-nio-8560-exec-5] ERROR org.camunda.bpm.engine.context@logError:160 - ENGINE-16004 Exception while closing command context: null
java.lang.NullPointerException: null
at org.camunda.bpm.engine.impl.cmd.GetNextIdBlockCmd.execute(GetNextIdBlockCmd.java:41)
at org.camunda.bpm.engine.impl.cmd.GetNextIdBlockCmd.execute(GetNextIdBlockCmd.java:28)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:107)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNewBlock(DbIdGenerator.java:49)
at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNextId(DbIdGenerator.java:41)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.ensureHasId(DbEntityManager.java:688)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.insert(DbEntityManager.java:570)
at org.camunda.bpm.engine.impl.persistence.entity.DeploymentManager.insertDeployment(DeploymentManager.java:52)
at org.camunda.bpm.engine.impl.cmd.DeployCmd.deploy(DeployCmd.java:486)
at org.camunda.bpm.engine.impl.cmd.DeployCmd$1.call(DeployCmd.java:142)
at org.camunda.bpm.engine.impl.cmd.DeployCmd$1.call(DeployCmd.java:130)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:482)
at org.camunda.bpm.engine.impl.cmd.DeployCmd.doExecute(DeployCmd.java:130)
at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:96)
at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:76)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:107)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.RepositoryServiceImpl.deployWithResult(RepositoryServiceImpl.java:102)
at org.camunda.bpm.engine.impl.repository.DeploymentBuilderImpl.deployWithResult(DeploymentBuilderImpl.java:270)
at org.camunda.bpm.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:266)
当我尝试执行以下代码时,会出现上述异常,
final Deployment deployment = repositoryService.createDeployment().addInputStream(fileNamePath, fis)
.name(deploymentData.getDeploymentName()).tenantId(deploymentData.getTenantId())
.enableDuplicateFiltering(deploymentData.isEnableDuplicateFiltering()).deploy();
所以这里的deploy()
方法抛出了这个异常。当我在 camunda 代码中调试它时,这个异常的确切位置来自 camunda 类 org.camunda.bpm.engine.impl.cmd.GetNextIdBlockCmd.execute(commandContext)。方法如下,这里属性为null,因此property.getValue()
抛出null。
public IdBlock execute(CommandContext commandContext) {
PropertyEntity property = commandContext
.getPropertyManager()
.findPropertyById("next.dbid");
long oldValue = Long.parseLong(property.getValue());
long newValue = oldValue+idBlockSize;
property.setValue(Long.toString(newValue));
return new IdBlock(oldValue, newValue-1);
}
我的基本流程图如下,[1]:https ://i.stack.imgur.com/9kP4F.png
解决方案
推荐阅读
- postgresql - Airflow 2.0.2:Dag 无法正确渲染模板
- r - if (getOption("Cardinal.dark")) { 中的错误:参数长度为零
- machine-learning - 如何逆向构建混淆矩阵形式评估指标值?
- php - 如何回显内部连接列名称
- flutter - 如何在 FutureBuilder Flutter 中停止循环 SetState
- node.js - NPM 包锁查询
- c++ - C、C++ 和 D (dlang) 的编译器资源管理器程序集输出
- flutter - Flutter SetState 不刷新 UI
- android - 在 Android Emulator 上运行应用程序时,如何在 Ionic React 应用程序中使用社区 HTTP 插件?
- python - 在图中创建断轴