cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti Explorer fails due the inability to upgrade Activiti DB schema version

ambharath
Champ in-the-making
Champ in-the-making
Hello All,

I am newbie in terms of Activiti Development…owing to the many advantages of this framework, I chose this as my BPM framework…

Whilst starting with the basics, I ran into the following query:

In activiti-explorer (ver 5.13), inside the activiti-engine-5.13 jar file, I don't see any upgrade (engine) scripts from version 5.11 to 5.12 & 5.12 to 5.13…eg: activiti.h2.upgradestep.511.to.512.engine & activiti.h2.upgradestep.512.to.513.engine are not to be found… is this an expected omission? If so, what is the work-around (other than the one mentioned by tiesebarrell) since I assume that whenever the activiti-explorer .war starts up (I am using Tomcat 7.0.42), it tries to upgrade the schema (when necessary, i.e., in case the schema version is older or lesser than the version of activiti-explorer)… I am using h2 database (ver 1.3.173)…

Can anyone please help!

Regards,
A M Bharath, new Activiti developer
5 REPLIES 5

trademak
Star Contributor
Star Contributor
I really don't now what you are talking about. In the org/activiti/db package you can find all db files including the upgrade files. Are you using a clean H2 database or do you already have an Activiti database with an older schema installed there?

Best regards,

ambharath
Champ in-the-making
Champ in-the-making
Hi Tijs,

In the  downloaded "activiti-explorer" (version 5.13) zip file, there is a jar called "activiti-engine-5.13.jar".  Upon extracting this, there is a path (which is exactly what you mentioned) as -> org/activiti/db/upgrade.

Inside this, the following upgrade sql files (w.r.t to h2) are found:

1) activiti.h2.upgradestep.50.to.51.engine
2) activiti.h2.upgradestep.53.to.54.engine
3) activiti.h2.upgradestep.54.to.55.engine
4) activiti.h2.upgradestep.58.to.59.engine
5) activiti.h2.upgradestep.59.to.510.engine
6) activiti.h2.upgradestep.510.to.511.engine

Here, if you see, some upgrade steps are missing (eg: 11-> 12, 12-13)…we are currently trying to upgrade from version 5.9 to 5.13. In particular, we created a maven project containing  code to deploy process files using (Activiti 5.9 jar is the version the pom file).

In H2 database, the schema.version being shown is also 5.9 after the process file got deployed.

Our activiti-explorer war file version, however, is 5.13 and this is deployed on Tomcat 7. While starting up Tomcat, this war file is connecting to the database (at least this was how I understood, so please correct me if I am wrong) and trying to upgrade the schema (probably to version 5.13) but is failing.

I think this is because of the missing SQL engine upgrade files inside the activiti-engine jar file present inside the activiti-explorer war file.

Can you please confirm my understanding and correct me where necessary?

-
A M Bharath

ambharath
Champ in-the-making
Champ in-the-making
Hi Tijs,

Just to give you an update, here's what I did (to give me expected behavior):

1) I chose a new H2 DB schema (a clean, fresh one with no tables in it initially)
2) Created a maven project with Activiti 5.13 as the jar version in the .pom file and wrote some code to deploy a sample bpmn20 process definition file to the aforesaid H2 DB.
3) As part of deployment, I could see console messages saying that create scripts were executed. Subsquently, the process file got deployed successfully. To confirm this, I logged into H2's web-console and checked the ACT_HI_PROCINST table for valid entries.
4) I deployed activiti-explorer (ver 5.13) on Tomcat 7, booted-up the server, logged into the explorer (kermit/kermit) and was able to view my deployments. Prior to this, I updated the DB entries in the war file's WEB-INF\activiti-standalone-context.xml & WEB-INF\classes\db.properties so as to point to my H2 database URL.
5) Also, in ACT_GE_PROPERTY, the schema.version value was 5.13 & schema.history was create(5.13)

So, in a case like this (where the version of activiti engine in the maven project is the same as the one inside the activiti-explorer war), no upgrade script is being executed.

However, in the earlier case (where the version of activiti engine in the maven project was 5.9  whereas that of the one inside activit-explorer was 5.13), something went wrong during the boot-up of activiti explorer and the upgrade steps just did  not go through as expected, As a result, the activiti-explorer didn't start at all.

That said, can you please give your insight into the following areas that are still grey for me?

1) How to deal with this case (when the project requires a new activiti jar to be used during the middle of development, like 5.9 originally and 5.13 later, mid-way)?
2) Will similar problems occur even when the version of the DB changes (like from Oracle 10 to Oracle 11)?
3) Most importantly, it is somewhat clear that programmatic deployment (through java code) compares versions and decides if an upgrade script has to be called. On the other hand, why does the activiti-explorer too do this? And how does it decide when to call the upgrade scripts?

Since I'm a newbie, please dont mind the sheer number of questions coming from me! Smiley Happy

-
A M Bharath

trademak
Star Contributor
Star Contributor
Hi,

The Activiti Engine JAR does contain all upgrade scripts needed. There's no upgrade for the engine tables in 5.12 and 5.13, only for the history tables.

1. We support this in two ways. One, you can let Activiti update the database automatically by setting databaseSchemaUpdate to true. The second option is to manually update the database schema based on the database upgrade scripts. For that option you set the databaseSchemaUpdate property to false.

2. Like mentioned in point 1 there two ways to deal with db updates and I don't see a problem with this.

3. The Activiti Explorer version is coupled directly to an Activiti Engine version. So it also needs the Activiti database to be on the same version.  The upgrade logic looks for the Activiti version in the ACT_GE_PROPERTY table and validates that against the Activiti version in the code, for example 5.13.

Best regards,

ambharath
Champ in-the-making
Champ in-the-making
Hi Tijs,

Many thanks for the reply - things are much more clear now.
I look forward to diving deeper into Activiti and will post queries (making sure to avoid duplication or redundancy) when I run into bottle necks.

-
A M Bharath