現象描述:按照正常配置,第一次啓動時不能自動建表java
關鍵配置片斷以下:spring
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="true" />
</bean>sql
啓動後報錯:數據庫
### The error may exist in org/activiti/db/mapping/entity/Property.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select VALUE_ from ACT_GE_PROPERTY where NAME_ = 'schema.version'
### Cause: java.sql.SQLSyntaxErrorException: ORA-00942: 表或視圖不存在app
通過調試分析,發現是關鍵判斷表是否存在代碼返回true值引發的,org.activiti.engine.impl.db.DbSqlSession.isTablePresent(String tableName);問題在於方法裏面的schema=null,而鏈接的數據庫實例下已經有另一個用戶activiti已經建立過表。調試
因而在引擎配置裏面加入屬性:xml
<property name="databaseSchema" value="act"/>對象
再啓動,成功建立表。到此本覺得問題已解決,停掉服務再次啓動,失敗,報建表錯誤:對象已存在。調試發現isTablePresent返回的仍是false(表還未建立)。it
發現是大小寫問題,最後改爲io
<property name="databaseSchema" value="ACT"/>
解決。