6 Flowable-Modeler详述之常见问题Table act_ge_property doesn't exist

  • 问题描述
  • 问题定位
  • 解决方案一
  • 解决方案二(推荐)
  • 验证结果

问题描述

在配置完Springboot的开发环境以后,启动的时候遇到了这个问题,数据库版本为mysql 5.7,Flowable版本为6.4.0,详细报错如下:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'flowController': Unsatisfied dependency expressed through field 'flowService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'flowServiceImpl': Unsatisfied dependency expressed through field 'repositoryService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'repositoryServiceBean' defined in class path resource [org/flowable/spring/boot/ProcessEngineServicesAutoConfiguration.class]: Unsatisfied dependency expressed through method 'repositoryServiceBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'processEngine' defined in class path resource [org/flowable/spring/boot/ProcessEngineServicesAutoConfiguration$AlreadyInitializedAppEngineConfiguration.class]: Unsatisfied dependency expressed through method 'processEngine' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowableAppEngine': FactoryBean threw exception on object creation; nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Table 'flowstudy.act_ge_property' doesn't exist
### The error may exist in org/flowable/db/mapping/entity/Property.xml
### The error may involve org.flowable.engine.impl.persistence.entity.PropertyEntityImpl.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: java.sql.SQLSyntaxErrorException: Table 'flowstudy.act_ge_property' doesn't existat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1341) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]at com.hyj.main.App.main(App.java:22) [classes/:na]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.5.RELEASE.jar:2.0.5.RELEASE]

问题定位

  • 看提示显示表不存在说明数据库中没有该表,此时查看的确没有,但是Flowable启动的时候应该会自动创建表的,说明表创建的逻辑判断发生问题
  • 查看代码发现判断主要函数为:
isEngineTablePresent

代码位于类 ProcessDbSchemaManager中,核心判断存在如下:

 public void schemaCreate() {this.getCommonSchemaManager().schemaCreate();this.getIdentityLinkSchemaManager().schemaCreate();this.getTaskSchemaManager().schemaCreate();this.getVariableSchemaManager().schemaCreate();this.getJobSchemaManager().schemaCreate();//使用这个函数判断是否要创建引擎if (this.isEngineTablePresent()) {String dbVersion = this.getDbVersion();if (!"6.4.0.0".equals(dbVersion)) {throw new FlowableWrongDbException("6.4.0.0", dbVersion);}} else {this.dbSchemaCreateEngine();}if (CommandContextUtil.getDbSqlSession().getDbSqlSessionFactory().isDbHistoryUsed()) {this.dbSchemaCreateHistory();}}

更新的时候,设置databaseSchemaUpdate=true的时候,走update,可以看到如下代码也是使用isEngineTablePresent来判断是否存在

public String schemaUpdate() {PropertyEntity dbVersionProperty = null;String dbVersion = null;String feedback = null;boolean isUpgradeNeeded = false;int matchingVersionIndex = -1;int version6120Index = FlowableVersions.getFlowableVersionIndexForDbVersion("6.1.2.0");DbSqlSession dbSqlSession = CommandContextUtil.getDbSqlSession();boolean isEngineTablePresent = this.isEngineTablePresent();if (isEngineTablePresent) {dbVersionProperty = (PropertyEntity)dbSqlSession.selectById(PropertyEntityImpl.class, "schema.version");dbVersion = dbVersionProperty.getValue();matchingVersionIndex = FlowableVersions.getFlowableVersionIndexForDbVersion(dbVersion);isUpgradeNeeded = matchingVersionIndex != FlowableVersions.FLOWABLE_VERSIONS.size() - 1;}boolean isHistoryTablePresent = this.isHistoryTablePresent();if (isUpgradeNeeded && matchingVersionIndex < version6120Index) {this.dbSchemaUpgradeUntil6120("engine", matchingVersionIndex);if (isHistoryTablePresent) {this.dbSchemaUpgradeUntil6120("history", matchingVersionIndex);}}this.getCommonSchemaManager().schemaUpdate();this.getIdentityLinkSchemaManager().schemaUpdate();this.getTaskSchemaManager().schemaUpdate();this.getVariableSchemaManager().schemaUpdate();this.getJobSchemaManager().schemaUpdate();if (isUpgradeNeeded) {dbVersionProperty.setValue("6.4.0.0");PropertyEntity dbHistoryProperty;if ("5.0".equals(dbVersion)) {dbHistoryProperty = (PropertyEntity)CommandContextUtil.getPropertyEntityManager().create();dbHistoryProperty.setName("schema.history");dbHistoryProperty.setValue("create(5.0)");dbSqlSession.insert(dbHistoryProperty);} else {dbHistoryProperty = (PropertyEntity)dbSqlSession.selectById(PropertyEntity.class, "schema.history");}String dbHistoryValue = "upgrade(" + dbVersion + "->" + "6.4.0.0" + ")";dbHistoryProperty.setValue(dbHistoryValue);if (version6120Index > matchingVersionIndex) {this.dbSchemaUpgrade("engine", version6120Index);} else {this.dbSchemaUpgrade("engine", matchingVersionIndex);}feedback = "upgraded Flowable from " + dbVersion + " to " + "6.4.0.0";} else if (!isEngineTablePresent) {this.dbSchemaCreateEngine();}if (isHistoryTablePresent) {if (isUpgradeNeeded) {if (version6120Index > matchingVersionIndex) {this.dbSchemaUpgrade("history", version6120Index);} else {this.dbSchemaUpgrade("history", matchingVersionIndex);}}} else if (dbSqlSession.getDbSqlSessionFactory().isDbHistoryUsed()) {this.dbSchemaCreateHistory();}return feedback;}
  • isEngineTablePresent代码实现如下:

可以看到使用的是表ACT_RU_EXECUTION是否存在来判断的

    public boolean isEngineTablePresent() {return this.isTablePresent("ACT_RU_EXECUTION");}
  • 进一步跟踪看到isTablePresent的实现如下:
 public boolean isTablePresent(String tableName) {DbSqlSession dbSqlSession = this.getDbSqlSession();DbSqlSessionFactory dbSqlSessionFactory = dbSqlSession.getDbSqlSessionFactory();if (!dbSqlSession.getDbSqlSessionFactory().isTablePrefixIsSchema()) {tableName = this.prependDatabaseTablePrefix(tableName);}Connection connection = null;try {connection = dbSqlSession.getSqlSession().getConnection();DatabaseMetaData databaseMetaData = connection.getMetaData();ResultSet tables = null;String catalog = dbSqlSession.getConnectionMetadataDefaultCatalog();if (dbSqlSessionFactory.getDatabaseCatalog() != null && dbSqlSessionFactory.getDatabaseCatalog().length() > 0) {catalog = dbSqlSessionFactory.getDatabaseCatalog();}String schema = dbSqlSession.getConnectionMetadataDefaultSchema();if (dbSqlSessionFactory.getDatabaseSchema() != null && dbSqlSessionFactory.getDatabaseSchema().length() > 0) {schema = dbSqlSessionFactory.getDatabaseSchema();} else if (dbSqlSessionFactory.isTablePrefixIsSchema() && StringUtils.isNotEmpty(dbSqlSessionFactory.getDatabaseTablePrefix())) {schema = dbSqlSessionFactory.getDatabaseTablePrefix();if (StringUtils.isNotEmpty(schema) && schema.endsWith(".")) {schema = schema.substring(0, schema.length() - 1);}}String databaseType = dbSqlSessionFactory.getDatabaseType();if ("postgres".equals(databaseType)) {tableName = tableName.toLowerCase();}if (schema != null && "oracle".equals(databaseType)) {schema = schema.toUpperCase();}if (catalog != null && catalog.length() == 0) {catalog = null;}boolean var10;try {//查询元数据中的表,根据schema和tablename查看tables = databaseMetaData.getTables(catalog, schema, tableName, JDBC_METADATA_TABLE_TYPES);var10 = tables.next();} finally {try {if (tables != null) {tables.close();}} catch (Exception var18) {LOGGER.error("Error closing meta data tables", var18);}}return var10;} catch (Exception var20) {throw new FlowableException("couldn't check if tables are already present using metadata: " + var20.getMessage(), var20);}}
  • 我们启动程序跟踪进入,查看使用getTables读取表,如下图所示:

    -因为机器上以前其他的mysql数据库中部署过Flowable的表,所以当schema为空的时候搜索mysql的元数据的时候搜索到了历史用的表,但是不在该数据库中,所以程序以为表已经有了,但是其实还是历史的表,到此我们基本上找到原因了。
  • 我们使用的驱动为8.0的驱动,8.0版本驱动将参数 nullCatalogMeansCurrent 的默认值由true改为了false,如果你使用DatabaseMetaData.getTables获取所有的表信息。

解决方案一

把正常的数据库的表导出为sql,手动创建表。

解决方案二(推荐)

mysql的连接字符串中添加上nullCatalogMeansCurrent=true,将schema默认设置为当前连接的schema。

验证结果

Flowable深入浅出-6 Flowable-Modeler详述之常见问题Table act_ge_property doesn‘t exist相关推荐

  1. 第6篇:Flowable-Modeler详述之常见问题Table act_ge_property doesn't exist

    接上一篇: 第5篇: Flowable-Modeler详述之开发环境搭建 https://blog.csdn.net/weixin_40816738/article/details/102887854 ...

  2. Flowable深入浅出-1 Flowable简介

    1 Flowable简介 什么是BPMN 什么是Flowable Flowable官网.开源社区 Flowable流程示例 版权 什么是BPMN 先来看下百度百科的定义: 由BPMI(The Busi ...

  3. 《Flowable基础二 Flowable是什么》

    2.1. Flowable是什么? Flowable是一个使用Java编写的轻量级业务流程引擎.Flowable流程引擎让你可以部署BPMN 2.0流程定义(用于定义流程的行业XML标准).创建这些流 ...

  4. Flowable工作流之Flowable UI画工作流程图

    目录 1. `Flowable` 简介 2. 绘制工作流程图 2.1. `Flowable UI` 的安装部署 2.2. 启动服务 2.3. 用户管理 2.4. 工作流程效果图 2.5. 绘制工作流程 ...

  5. Flowable深入浅出-13 Flowable-BPMN操作流程之流程进展查看之流程图

    13 Flowable-BPMN操作流程之流程进展查看之流程图 背景 原理 实现方案 验证 代码下载 背景 流程启动后,为了方便我们查看流程的进展,Flowable提供了流程图可以直观的查看流程的进展 ...

  6. Flowable高级篇 - Flowable表结构

    Flowable中文手册 一.flowable表结构 数据库表命名规则: ACT_RE_*:其中"RE"表示repository(存储)的意思,是RepositoryService ...

  7. flowable+tomcat部署flowable项目,在线画流程图

    前置条件:jdk8,tomcat8(注意:jdk7可能会报错) flowable下载地址 https://github.com/flowable/flowable-engine/releases/do ...

  8. Flowable高级篇 - Flowable的图标

    flowable的中文手册 介绍: BPMN 2.0是业务流程建模符号2.0的缩写.它由Business Process Management Initiative这个非营利协会创建并不断发展.作为一 ...

  9. 第7篇:Flowable-Modeler集成之Flowable源码编译

    接上一篇: 第6篇:Flowable-Modeler详述之常见问题Table act_ge_property doesn't exist https://blog.csdn.net/weixin_40 ...

最新文章

  1. python sklearn 梯度下降法_科学网—Python_机器学习_总结4:随机梯度下降算法 - 李军的博文...
  2. python 列表为空_如果列表为空,则Python返回False
  3. django 坑~~
  4. 第10章 文档对象模型DOM 10.2 Document类型
  5. glusterfs的一些基本知识
  6. 小甲鱼零基础入门python课后作业及答案_小甲鱼python视频第四讲(笔记及课后习题答案)...
  7. python爬虫淘宝评论_Python爬虫,抓取淘宝商品评论内容
  8. Mac系统使用idea常用快捷键
  9. python opencv Shi-Tomasi 角点检测和特征跟踪
  10. 移动端触摸(touch)事件
  11. 软件测试面试题-那些让我印象深刻的bug
  12. 网贷风控体系之-系统架构
  13. 再先进的在线教学,也要回归这个本质
  14. python新浪股票接口_python 爬虫sina股票数据
  15. pandas dataframe rolling 移动计算
  16. 网站服务器配置e5,从性能到配置 E5服务器全面扫描
  17. MCR和MRC汇编指令
  18. 安卓小人html制作,告白小人在线制作
  19. java虚拟机读书笔记 第三章 垃圾收集器和内存分配策略
  20. 1 W 字 | 硬刚 MySQL

热门文章

  1. hdu 2602 dp
  2. [BZOJ1567][JSOI2008]Blue Mary的战役地图(二分+矩阵hash)
  3. Chrome浏览器如何强制刷新页面(不使用缓存)?
  4. bitxhub跨链实战
  5. vue_ts 编写vue的声明文件
  6. 队列和栈是什么,列出它们的区别?
  7. 新一轮融资惹外界热议 闪送能否担当即时配送领头羊重任?
  8. 红旗linux无线网卡驱动,红旗Linux下配置无线网卡(驱动安装/wep sid设置)[图文]
  9. 直播预告 | 北京大学、北京航空航天大学、阿里巴巴、小米的四位讲者来啦!...
  10. 开源日志监控采集平台ELKF