cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure Activiti Explorer and REST to use the same database

ardamose123
Champ on-the-rise
Champ on-the-rise
I have fresh installations of activiti-explorer and activiti-rest running in a local Tomcat server. Both have exactly the same db.properties configuration (the original H2 database). However, any change I apply using Activiti Explorer is not reflected in the REST API (using curl), nor the other way aorund.

As a test, I started some processes in Explorer and tried to list them using the REST API, but active processes list, deployments and tasks method calls return empty. Using the REST API, I removed Gonzo from the Marketing group, but in Explorer Gonzo is still in it.

Is there a way in which I can tell Explorer and the REST API to use the very same H2 database? Or do I have to use a persistent one (Postgre, Oracle, MySQL…)?

Thanks in advance!
14 REPLIES 14

slehman
Champ in-the-making
Champ in-the-making
I ran into the same thing - I thought it would work since it looked like it was using H2 in a mode that allowed multiple connections from a single process.

Running H2 in server mode did the trick though.

  • To run in server mode, locate the jar and issue a command like:
  • <code> java -cp h2-1.3.171.jar org.h2.tools.Server -tcpPort 2962</code>.  (The port number appeared to vary on each run, so I gave it a fixed port.)
  • Update the JDBC urls in the db.properties files for both web apps.
  • <code>jdbc.url=jdbc:h2:tcp://localhost:2962/~/test</code> (if the server binds to a specific IP address, you may need to use that)

jbarrez
Star Contributor
Star Contributor
@slehman: exactly the way it should be!

jcoveron
Champ in-the-making
Champ in-the-making
Greetings.

I am trying to do the same thing but with a MySQL database.
Both my db.properties file for the activiti-explorer and activiti-rest look like this:

db=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti
jdbc.username={mysql user}
jdbc.password={mysql password}

Any chance you could provide a guide on how to configure them to see the same MySQL database.

Sorry for the trouble and thanks in advance.

jbarrez
Star Contributor
Star Contributor
That should pretty much be it - but it seems its not working for you? Do you have any exceptions?

jcoveron
Champ in-the-making
Champ in-the-making
Hi
Thanks for the reply. The configuration is working, I just wanted to make sure I understood correctly as am new at Activiti.
Once again, thanks for the kind help.
Regards

feroz1
Champ in-the-making
Champ in-the-making
Hi,
I’ve created a sample process(with just 2 user tasks in sequence) and deployed through REST and all the REST API calls work fine. When I deploy the activiti explorer war along with the REST(both pointing to same DB), I could see the process and the tasks in the explorer. However, if I the restart the server, it’s not persisting the state of the process instance. For example, if I complete task1 and restart the server, it doesn’t show that instance nor task2 anymore. However, it works fine with just the rest.

Can someone please let me know if I missed configuring something?

Thanks!

Feroz.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Feroz,

By default activity is configured in memory DB.
If you want to persist state, configure another data source to store the data.
Regards
Martin

feroz1
Champ in-the-making
Champ in-the-making
Hi Martin, I did configure to point both rest and explorer to point to mysql database.

jbarrez
Star Contributor
Star Contributor
So when you shut down the server, you should have an entry in your ACT_RU_TASK. Is that the case?