1. 自定义类继承SpringProcessEngineConfiguration类,重写initDatabaseType方法。
package com.ydtf.cbda.module.cbdacim.improcess.config;
import org.activiti.engine.ActivitiException;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
public class CustomConnectionSpringProcessEngineConfiguration extends SpringProcessEngineConfiguration {
private static Logger log = LoggerFactory.getLogger(CustomConnectionSpringProcessEngineConfiguration.class);
public void initDatabaseType() {
Connection connection = null;
connection = this.dataSource.getConnection();
DatabaseMetaData databaseMetaData = connection.getMetaData();
String databaseProductName = databaseMetaData.getDatabaseProductName();
log.debug("database product name: '{}'", databaseProductName);
this.databaseType = databaseTypeMappings.getProperty(databaseProductName);
if (databaseProductName.contains("DM DBMS")) {
databaseProductName = "Oracle";
databaseType = databaseTypeMappings.getProperty(databaseProductName);
if (this.databaseType == null) {
throw new ActivitiException("couldn't deduct database type from database product name '" + databaseProductName + "'");
log.debug("using database type: {}", this.databaseType);
if ("mssql".equals(this.databaseType)) {
this.maxNrOfStatementsInBulkInsert = this.DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER;
} catch (SQLException var12) {
log.error("Exception while initializing Database connection", var12);
if (connection != null) {
} catch (SQLException var11) {
log.error("Exception while closing the Database connection", var11);
2. 修改Activiti启动项配置
package com.ydtf.cbda.module.cbdacim.improcess.config;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
public class ActivitiConfigguration {
private DataSource dataSource;
private PlatformTransactionManager transactionManager;
public SpringProcessEngineConfiguration getProcessEngineConfiguration() {
SpringProcessEngineConfiguration configuration = new CustomConnectionSpringProcessEngineConfiguration();
configuration.setDataSource(dataSource);
configuration.setTransactionManager(transactionManager);
configuration.setDatabaseSchemaUpdate("true");
public TaskExecutor primaryTaskExecutor(){
return new ThreadPoolTaskExecutor();