0
votes

I am currently working on an activiti prototype where in I have added activiti process flow to an existing JavaEE dynamic web project.

The whole point of the prototype is to access the database of activiti mainly their ACT_RU table and add our own table which uses process instance ID as the foreign key.

According to what I have read, activiti database tables are created the minute you start a process flow.

Here is what I ahve done till now : 1. activiti cfg.jar has activiti.cfg file :

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">

<property name="databaseType" value="h2" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jdbcUrl" value="jdbc:h2:~/test/db/activiti" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value=""/>

  1. there is an applicationContext.xml in my project classpath :

  2. I have added a data source in tomcat as follows :

    <Resource name="jdbc/H2DB" auth="Container" type="javax.sql.DataSource"
           maxActive="100" maxIdle="30" maxWait="10000"
           username="sa" password="" driverClassName="org.h2.Driver"
           url="jdbc:h2:~/test/db/activiti"/>
    

    Despite all of this, the activiti tables are never created. I cannot see them on H2 console. Is this the right approach, am I missing any other xml files?

2

2 Answers

0
votes

Meghana,

Make sure you have your database creation property "databaseSchemaUpdate" set to either true or create-drop. Otherwise tables will not be created automatically.

Hope this helps. Greg Harley - BP3

0
votes

Make sure you are reading the XML file in your code:

ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); 

Here is my XML file:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="false" />
<property name="mailServerHost" value="mail.my-corp.com" />
<property name="mailServerPort" value="5025" />
</bean>
</beans>

Here is part of my POM file :

<properties>
    <activiti-version>5.10</activiti-version>
    <spring-version>3.1.0.RELEASE</spring-version>
    <cxf-version>2.4.4</cxf-version>
    <drools-version>5.3.0.Final</drools-version>
</properties>