Database table generation fails on Oracle if multiple activiti engine schematas are visible to the database user

Description

I am currently testing the Activiti engine in conjunction with an Oracle 11g database and experience issues with having multiple engines (and database schematas).

Lets say an engine is running using a specific database schema A.

Starting another engine with automatic database table generation on a schema B enabled will fail if the database user configured for the second engine can "see" the first engines database schema. This prevents the engine from starting up.

Tracking the problem I figured out the root cause of the problem lies in org.activiti.engine.impl.db.DbSqlSession:

  • DbSqlSession#dbSchemaCreate is invoked to create a schema

  • DbSqlSession#isEngineTablePresent is invoked to see if ACT_RU_EXECUTION table is present

  • DbSqlSession#isTablePresent("ACT_RU_EXECUTION") yields true, because table exists as A.ACT_RU_EXECUTION. The reason for returning table metadata for schema A is that connectionMetadataDefaultCatalog and connectionMetadataDefaultSchema properties are null

  • DbSqlSession#isEngineTablePresent returns true

  • DbSqlSession#getDbVersion is called and yields the stacktrace printed

15:14:59,967 SEVERE [org.activiti.engine.impl.interceptor.CommandContext] (MSC service thread 1-1) Error while closing command context: org.apache.ibatis.exceptions.PersistenceException:

  1.  

    1.  

      1. Error querying database. Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

  1.  

    1.  

      1. The error may involve defaultParameterMap

      2. The error occurred while setting parameters

      3. Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8) [mybatis-3.0.6.jar:]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:81) [mybatis-3.0.6.jar:]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:73) [mybatis-3.0.6.jar:]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:39) [mybatis-3.0.6.jar:]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:34) [mybatis-3.0.6.jar:]
at org.activiti.engine.impl.db.DbSqlSession.getDbVersion(DbSqlSession.java:537) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCreate(DbSqlSession.java:552) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:887) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:59) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:77) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:272) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.ProcessEngines.buildProcessEngine(ProcessEngines.java:177) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.ProcessEngines.initProcessEnginFromResource(ProcessEngines.java:150) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.ProcessEngines.init(ProcessEngines.java:88) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.engine.ProcessEngines.getProcessEngine(ProcessEngines.java:207) [activiti-engine-5.9-SNAPSHOT.jar:]
at org.activiti.cdi.impl.LocalProcessEngineLookup.getProcessEngine(LocalProcessEngineLookup.java:42) [activiti-cdi-5.9-SNAPSHOT.jar:]
at org.activiti.cdi.impl.ActivitiExtension.initializeProcessEngine(ActivitiExtension.java:73) [activiti-cdi-5.9-SNAPSHOT.jar:]
at org.activiti.cdi.impl.ActivitiExtension.afterDeploymentValidation(ActivitiExtension.java:62) [activiti-cdi-5.9-SNAPSHOT.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_02]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0_02]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0_02]
at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_02]
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:75) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:46) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:31) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:369) [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.weld.services.WeldService.start(WeldService.java:89) [jboss-as-weld-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0_02]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0_02]
at java.lang.Thread.run(Thread.java:722) [:1.7.0_02]

A workaround i am currently investigating is to restrict visibility of the database user to his own schema.

Environment

Oracle 11g
JBoss AS 7
Activiti 5.8 / 5.9

Assignee

Bernd Ruecker (camunda)

Reporter

Nico Rehwaldt (camunda)

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure