Spring boot 整合Activiti中遇到的問題


 Pom.xml 配置
<!-- activiti --> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring-boot-starter-basic</artifactId> <version>6.0.0</version> </dependency> <!-- mysql 驅動 --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.38</version> </dependency>
#連接信息application.properties
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/jt?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
spring.datasource.username=root
spring.datasource.password=root
spring.activiti.check-process-definitions: false
SpringBoot啟動
啟動報錯
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;
2、org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource 
解決辦法:啟動類上加上 @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.properties文件中加上如下配置(注意是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

No.4
啟動報錯:
Error querying database. Cause: java.sql.SQLSyntaxErrorException
解決方法: (1)把mysql8.0的版本改成5.0的 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.41</version> </dependency> (2)修改驅動: com.mysql.jdbc.Driver


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM