如何配置 Camunda 7.10(Wildfly 完整发行版)以使用 Oracle 数据库?

How to configure Camunda 7.10 (Wildfly full distribution) to work with Oracle database?

我已经下载了 Camunda 7.10(Wildfly 完整发行版),使用默认的 H2(内存中)数据库进行了一些测试,一切正常。

然后我将 standalone.xml 配置为使用 Oracle 11g 数据库。 一旦我启动部署了 camunda-example-invoice-7.10.0.war 的服务器,我就得到了异常:

12:12:45,570 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service org.camunda.bpm.platform.process-application-module."deployment.camunda-example-invoice-7.10.0.war".START: org.jboss.msc.service.StartException in service org.camunda.bpm.platform.process-application-module."deployment.camunda-example-invoice-7.10.0.war".START: Exception while invoking the @PostDeploy method
        at org.camunda.bpm.container.impl.jboss.service.ProcessApplicationStartService.invokePostDeploy(ProcessApplicationStartService.java:223)
        at org.camunda.bpm.container.impl.jboss.service.ProcessApplicationStartService.start(ProcessApplicationStartService.java:152)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
        at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.camunda.bpm.application.ProcessApplicationExecutionException: java.lang.reflect.InvocationTargetException
        at org.camunda.bpm.application.impl.ProcessApplicationLogger.processApplicationExecutionException(ProcessApplicationLogger.java:94)
        at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:120)
        at org.camunda.bpm.container.impl.jboss.service.ProcessApplicationStartService.invokePostDeploy(ProcessApplicationStartService.java:215)
        ... 9 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.camunda.bpm.container.impl.jboss.service.ProcessApplicationStartService.call(ProcessApplicationStartService.java:218)
        at org.camunda.bpm.container.impl.jboss.service.ProcessApplicationStartService.call(ProcessApplicationStartService.java:215)
        at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:117)
        ... 10 more
Caused by: org.camunda.bpm.engine.OptimisticLockingException: ENGINE-03005 Execution of 'UPDATE TaskEntity[0ec55ac9-77ed-11e9-a885-024251084739]' failed. Entity was updated by another transaction concurrently.
        at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.concurrentUpdateDbEntityException(EnginePersistenceLogger.java:134)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.handleOptimisticLockingException(DbEntityManager.java:498)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.checkFlushResults(DbEntityManager.java:450)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:366)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:324)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:296)
        at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:207)
        at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:136)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:115)
        at org.camunda.bpm.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:60)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:69)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
        at org.camunda.bpm.engine.impl.TaskServiceImpl.claim(TaskServiceImpl.java:168)
        at org.camunda.bpm.example.invoice.InvoiceProcessApplication.startProcessInstances(InvoiceProcessApplication.java:157)
        at org.camunda.bpm.example.invoice.InvoiceProcessApplication.startFirstProcess(InvoiceProcessApplication.java:63)
        ... 17 more

这是我的数据源配置:

<xa-datasource jndi-name="java:jboss/datasources/ProcessEngine" pool-name="ProcessEngineDS" enabled="true" use-ccm="true">
    <xa-datasource-property name="URL">
        jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(FAILOVER=on)(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.2.3)(PORT=1551))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=testserv)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=5)(DELAY=3))))
    </xa-datasource-property>
    <driver>ojdbc7</driver>
    <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
    <xa-pool>
        <is-same-rm-override>false</is-same-rm-override>
        <no-tx-separate-pools>true</no-tx-separate-pools>
    </xa-pool>
    <security>
        <user-name>camunda</user-name>
        <password>camunda</password>
    </security>
    <validation>
        <background-validation>true</background-validation>
        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
        <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
        <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
    </validation>
</xa-datasource>

如何正确配置数据库?

Camunda 7.10 默认使用 Jdbc Batch Processing,适用于 Oracle 12c 或更新版本。由于您仍在使用 Oracle 11g,因此您必须设置 jdbcBatchProcessing=false:

Another configuration - jdbcBatchProcessing - sets if batch processing mode must be used when sending SQL statements to the database. When switched off, statements are executed one by one. Values: true (default), false.

Known issues with batch processing:

  • batch processing is not working for Oracle versions earlier than 12.
  • when using batch processing on MariaDB and DB2, jdbcStatementTimeout is being ignored.