1. 程式人生 > >springboot整合activiti工作流時容易出現的問題

springboot整合activiti工作流時容易出現的問題

No.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;

解決辦法:啟動類上加上 @SpringBootApplication(exclude = SecurityAutoConfiguration.class)即可;因為

activiti-spring-boot-starter-basic中引用了spring-boot-starter-security(具體沒研究)

 

No.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資料夾;

解決辦法:在resource目錄下新增processes資料夾,並且資料夾不能為空 或是在application.yml檔案中加上如下配置(注意是spring節點下)

activiti:
database-schema-update: true
# 自動部署驗證設定:true-開啟(預設)、false-關閉
check-process-definitions: false

 

No.3

啟動報錯

 

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'runtimeServiceBean' defined in class path resource [com/example/config/ActivitiConfig.class]: Unsatisfied dependency expressed through method 'runtimeServiceBean' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName.

解決辦法:配置資料來源時url前加上jdbc-;如:jdbc-url: jdbc:mysql://localhost:3306/activity?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8