1、啓動報錯
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.activiti.spring.boot.SecurityAutoConfiguration':
Initialization of bean failed; nested exception is java.lang.ArrayStoreException:
sun.reflect.annotation.TypeNotPresentExceptionProxy;
(1)解決辦法:啓動類上加上@SpringBootApplication(exclude = SecurityAutoConfiguration.class)即可;
(2)原因:activiti-spring-boot-starter-basic中引用了spring-boot-starter-security。
2、啓動報錯
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'springProcessEngineConfiguration' defined in class path resource
[xxxxx/xxxx/xxx.java]: Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.activiti.spring.SpringProcessEngineConfiguration]:
Factory method 'springProcessEngineConfiguration' threw exception;
nested exception is java.io.FileNotFoundException:
class path resource [processes/] cannot be resolved to URL because it does not exist;
解決辦法:在resource目錄下添加processes文件夾,並且文件夾不能爲空或是在配置文件中加上如下配置
(1)application.yml文件
spring:
activiti:
database-schema-update: true
#自動部署驗證設置:true-開啓(默認)、false-關閉
check-process-definitions: false;
(2)application.properties文件
spring.activiti.database-schema-update=true
spring.activiti.check-process-definitions=false
3、啓動報錯
Caused by: java.sql.SQLSyntaxErrorException: Table 'activiti.act_ge_property' doesn't exist
(1)解決辦法:yml或properties配置文件中,配置mysql連接時加上:nullCatalogMeansCurrent=true
(2)原因:mysql版本問題,mysql 8.xx以上驅動會出現這個問題,因爲mysql使用schema標識庫名而不是catalog,因此mysql
會掃描所有的庫來找表,如果其他庫中有相同名稱的表,activiti就以爲找到了,本質上這個表在當前數據庫中並不存在。設置
nullCatalogMeansCurrent=true,表示mysql默認當前數據庫操作,在mysql-connector-java 5.xx該參數默認爲true,在6.xxx以上
默認爲false,因此需要設置nullCatalogMeansCurrent=true。
文章參考一篇博客,具體記不清了。