How we can manage TableSpace with Oracle for activiti

cancel
Showing results for 
Search instead for 
Did you mean: 
dharamjeet
Active Member II

How we can manage TableSpace with Oracle for activiti

Jump to solution

I need to know how we can manage tablespace with oracle db  as database for activiti enterpirse. I found we have no way to configure in activiti.

1 Solution

Accepted Solutions
dharamjeet
Active Member II

Re: How we can manage TableSpace with Oracle for activiti

Jump to solution

Yes It worked. This is what I did.

Thank you very much.

@Bean
 public BeanPostProcessor activitiConfigurer() {
  return new BeanPostProcessor() {
   @Override
   public Object postProcessBeforeInitialization(Object bean, String beanName) {
    if (bean instanceof SpringProcessEngineConfiguration) {
     ((SpringProcessEngineConfiguration) bean).setActivityBehaviorFactory(rcActivitiBehaviourFactory);
     ((SpringProcessEngineConfiguration) bean).setDatabaseSchema("orcl");
    }
    return bean;
   }
   @Override
   public Object postProcessAfterInitialization(Object bean, String beanName) {
    return bean;
   }
  };
 }

View solution in original post

8 Replies
gdharley
Intermediate

Re: How we can manage TableSpace with Oracle for activiti

Jump to solution

Not sure what you mean.

Can you provide more details.

Thanks,
Greg

daisuke-yoshimo
Senior Member

Re: How we can manage TableSpace with Oracle for activiti

Jump to solution

Are you questioning how to specify the user and schema of Oracle database, not the tablespace?
If you specify the user and schema of Oracle database, tablespace is determined automatically from the user and schema.

If you want to specify the user and schema of Oracle database, you should use setDataSource(DataSource dataSource) and setDatabaseSchema(String databaseSchema).

・setDataSource(DataSource dataSource) or setDataSourceJndiName(String dataSourceJndiName)
https://www.activiti.org/javadocs/org/activiti/engine/ProcessEngineConfiguration.html#setDataSource-...
https://www.activiti.org/javadocs/org/activiti/engine/ProcessEngineConfiguration.html#setDataSourceJ...

・setDatabaseSchema(String databaseSchema)
https://www.activiti.org/javadocs/org/activiti/engine/ProcessEngineConfiguration.html#databaseSchema

dharamjeet
Active Member II

Re: How we can manage TableSpace with Oracle for activiti

Jump to solution

I'm creating a user named test2 and granting it dba permissions. Now I created a new tablespace  test1 of size 100M and set it as default tablespace for test2 user.

Before starting activiti I have my activity app configured with properties-

datasource.driver=oracle.jdbc.driver.OracleDriver
datasource.url=jdbcSmiley Surprisedracle:thin:@localhost:1521Smiley Surprisedrcl
datasource.username=test2
datasource.password=test2

with oracle dialect.

Now I'am starting the activiti and it starts initializing by creating its tables but fails to startup as it is throwing SQLException

### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:73)
        at org.activiti.engine.impl.db.DbSqlSession.selectById(DbSqlSession.java:470)
        at org.activiti.engine.impl.db.DbSqlSession.dbSchemaUpdate(DbSqlSession.java:1028)
        at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:1421)
        at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:27)
        at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
        at org.activiti.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:80)
        at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:627)
        at org.activiti.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:65)
        at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:60)
        at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1517)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor$1.intercept(ConfigurationClassEnhancer.java:379)
        at org.activiti.spring.ProcessEngineFactoryBean$$EnhancerBySpringCGLIB$$913f0166.getObject(<generated>)
        at com.activiti.conf.ActivitiEngineConfiguration.processEngine(ActivitiEngineConfiguration.java:107)
        at com.activiti.conf.ActivitiEngineConfiguration.runtimeService(ActivitiEngineConfiguration.java:258)
        at com.activiti.conf.ActivitiEngineConfiguration$$EnhancerBySpringCGLIB$$fa41e948.CGLIB$runtimeService$10(<generated>)
        at com.activiti.conf.ActivitiEngineConfiguration$$EnhancerBySpringCGLIB$$fa41e948$$FastClassBySpringCGLIB$$ee352afc.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
        at com.activiti.conf.ActivitiEngineConfiguration$$EnhancerBySpringCGLIB$$fa41e948.runtimeService(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
        at com.activiti.servlet.WebConfigurer.contextInitialized(WebConfigurer.java:87)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
when I just create user which has Users tablespace as default, and startup the activity it runs perfectly fine.
I'm I doing anything wrong while setting the default tablespace for a user?
dharamjeet
Active Member II

Re: How we can manage TableSpace with Oracle for activiti

Jump to solution

Table doesn't get created ACT_GE_PROPERTY in the database. but when I query 'desc model' in database it finds model table , I don't understand why activity is not creating this table with all the other tables.

daisuke-yoshimo
Senior Member

Re: How we can manage TableSpace with Oracle for activiti

Jump to solution

Thank you for your all stack trace and I understood the cause.


But, if you use activiti-explorer, it is difficult to resolve the problem.

If you use directly activiti-engine, you can use setDatabaseSchema(String databaseSchema).
If you use activiti-explorer, you cannot set databaseSchema.
https://www.activiti.org/javadocs/org/activiti/engine/ProcessEngineConfiguration.html#databaseSchema

If you use activiti-explorer and want to resolve this problem, you limit the user's(test2) authority, not use dba permissions.

The cause
Activiti engine check which the table already exists in the database by using your datasource setting.
Your datasource setting contains dba permissions and activiti engine can get information on tables of other schemas and mistakenly judge that the table has already been created.

If you set datasource and schema, activiti engine can get information on tables of only your schema and don't mistakenly judge.

daisuke-yoshimo
Senior Member

Re: How we can manage TableSpace with Oracle for activiti

Jump to solution

> If you use activiti-explorer, you cannot set databaseSchema.

Perhaps, you can specify the schema by changing the following settings.
activiti-rest/WEB-INF/classes/META-INF/activiti-rest/activiti-custom-context.xml

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">

<property name="databaseSchema" ref="test2" />
<property name="dataSource" ref="dataSource" />

<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="mailServerHost" value="localhost" />
<property name="mailServerPort" value="5025" />
<property name="historyLevel" value="full" />
<property name="jobExecutorActivate" value="false" />
<property name="asyncExecutorEnabled" value="false" />
<property name="asyncExecutorActivate" value="false" />
</bean>

Or, you may resolve to set schemaUpdate setting as false.
activiti-rest/WEB-INF/classes/META-INF/activiti-rest/engine.properties
engine.schema.update=true

dharamjeet
Active Member II

Re: How we can manage TableSpace with Oracle for activiti

Jump to solution

Yes It worked. This is what I did.

Thank you very much.

@Bean
 public BeanPostProcessor activitiConfigurer() {
  return new BeanPostProcessor() {
   @Override
   public Object postProcessBeforeInitialization(Object bean, String beanName) {
    if (bean instanceof SpringProcessEngineConfiguration) {
     ((SpringProcessEngineConfiguration) bean).setActivityBehaviorFactory(rcActivitiBehaviourFactory);
     ((SpringProcessEngineConfiguration) bean).setDatabaseSchema("orcl");
    }
    return bean;
   }
   @Override
   public Object postProcessAfterInitialization(Object bean, String beanName) {
    return bean;
   }
  };
 }
dharamjeet
Active Member II

Re: How we can manage TableSpace with Oracle for activiti

Jump to solution

thanks daisuke-yoshimoto, I am using enterprise version so I changed it through java configuration and it worked for me.