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

文章目录

  • 1. 问题描述
  • 2. 问题定位
  • 解决方案一
  • 解决方案二(推荐)

1. 问题描述

在配置完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]

2. 问题定位

看提示显示表不存在说明数据库中没有该表,此时查看的确没有,但是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。

完整的数据库配置信息

# 数据源配置
spring:datasource:driverClassName: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/flowstudy?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&autoReconnect=true&&zeroDateTimeBehavior=convertToNull&useSSL=true&allowMulQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: root

下一篇:
第7篇:Flowable-Modeler集成之Flowable源码编译
https://blog.csdn.net/weixin_40816738/article/details/102899693

第6篇:Flowable-Modeler详述之常见问题Table act_ge_property doesn't exist相关推荐

  1. Flowable深入浅出-6 Flowable-Modeler详述之常见问题Table act_ge_property doesn‘t exist

    6 Flowable-Modeler详述之常见问题Table act_ge_property doesn't exist 问题描述 问题定位 解决方案一 解决方案二(推荐) 验证结果 问题描述 在配置 ...

  2. 第5篇:Flowable-Modeler详述之开发环境搭建

    接上一篇: 第4篇:Flowable-Modeler详述之流程概述 https://blog.csdn.net/weixin_40816738/article/details/102886712 文章 ...

  3. 第3篇:Flowable-IDM详述

    接上一篇: 第2篇:Flowable启动 https://blog.csdn.net/weixin_40816738/article/details/102875324 文章目录 一.Flowable ...

  4. 第4篇:Flowable-Modeler详述之流程概述

    接上一篇 第3篇:Flowable-IDM详述 https://blog.csdn.net/weixin_40816738/article/details/102885902 文章目录 一.Flowa ...

  5. Flowable入门系列文章86 - Flowable Modeler应用程序

    Flowable Modeler应用程序可用于对BPMN流程,DMN决策表,表单定义和创建应用程序定义进行建模.BPMN建模人员使用与Flowable 5 中相同的Oryx和Angular基础,但是现 ...

  6. mix2s适配鸿蒙,技巧篇:MIX2S使用三大常见问题 95%的小米用户都在关注

    原标题:技巧篇:MIX2S使用三大常见问题 95%的小米用户都在关注 小米mix 2s已经售卖几天了,不知道大家有没有如愿抢到自己的手机呢?没有入手的也没关系,我们先来看一看小米mix 2s手机用户对 ...

  7. Flowable6.5 之 springboot集成flowable modeler设计器

    源码 githup上下载老版本源码https://github.com/flowable/flowable-engine/releases gitHub:https://github.com/flow ...

  8. springboot和flowable modeler整合

    准备:项目使用的是springboot2.1.5版本,flowable6.4.0版本 1. IDEA新建Spring Initializr项目,选择依赖,web和MySQL 2. 修改pom.xml依 ...

  9. ESP32-C3入门教程 WiFi篇⑨——WiFi配网失败常见问题与解决办法(找不到WiFi AP | WiFi密码错误 | 距离AP过远 RSSI判断)

    文章目录 一.前言 二.WiFi配网的常见问题 三.5GHz WiFi 四.找不到WiFi AP 4.1 App限制WiFi名称的输入 4.2 设备回传 配网失败错误码 五.WiFi密码错误 5.1 ...

最新文章

  1. [日推荐]『保养汽车』爱车的专职管家
  2. rknn 学习资料整理
  3. python爬虫软件-8个最高效的Python爬虫框架,你用过几个?
  4. HDOJ 1082 模拟 水
  5. 降低百倍时间步,精度媲美传统神经网络:上交等机构提出ANN-SNN转换框架
  6. WordPress电影资源下载主题:zmovie
  7. 如何实现Outlook 2010 下载邮件后自动删除服务器上的邮件
  8. 两个有序数组求中位数log(m+n)复杂度
  9. java不能对什么类型进行转换_@Value - 无法将类型'java.lang.String'的值转换为所需类型'java.lang.Integer'...
  10. 基于MATLAB的基础图像分析
  11. 台电固态硬盘用什么测试软件,常规测试、实际使用测试与总结_固态硬盘评测-中关村在线...
  12. OpenCV调用工业相机
  13. 在椭球面上使用球面坐标系法做三重积分
  14. 防灾科技学院考研计算机,防灾科技学院考研难吗
  15. Android下操作FrameBuffer
  16. scp远程复制文件自动输入密码
  17. 5g通用模组是什么_目前主流的5G模组有哪些?
  18. SLAM十四讲第三章课后习题
  19. 富士康服务器主板装系统,富士康主板如何刷bios 富士康主板刷bios的技巧
  20. 7-22 超市贴花 (15 分)

热门文章

  1. c语言边序列构造邻接表,结构C语言版期末考试考试(有答案).doc
  2. 批量引号_RcoketMQ 批量发送和消息过滤
  3. Python 的协程
  4. myeclipse导入项目报错Target runtime Apache Tomcat v8.0 is not defined
  5. Linux常用指令2
  6. 师--链表的结点插入
  7. /usr/bin/ld: 找不到 -lopencv_dep_cudart
  8. 阿里云荣获可信云容器安全能力先进级认证, ACK/ACR为企业级安全护航
  9. Timestream开发最佳实践
  10. 可应用于实际的14个NLP突破性研究成果(三)