Cannot create a processEngine via java api

My default engine datasource config is

datasource:
url: jdbc:mysql://localhost:13306/hikedu_backend?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT&zeroDateTimeBehavior=CONVERT_TO_NULL
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
initialization-mode: never

The second engine datasource config is

datasource:
url: jdbc:mysql://localhost:13306/hikedu_default?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT&zeroDateTimeBehavior=CONVERT_TO_NULL
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
initialization-mode: never

How I do for create the second engine ?
I created a class that is implemented the ApplicationRunner interface
The code of for create second engine was writed in the run method.
Here is the code

SpringProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()
.setDataSource(dataSource)
.setProcessEngineName(“second”)
.setDatabaseSchemaUpdate(“true”)
.setHistory(ProcessEngineConfiguration.HISTORY_FULL)
.buildProcessEngine();

The database of the second engine was empty but camunda says :

 2018-12-12 17:20:07,803 ERROR [restartedMain] o.c.b.e.context [BaseLogger.java:156] ENGINE-16004 Exception while closing command context: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Table 'hikedu_default.ACT_GE_PROPERTY' doesn't exist
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Property.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: java.sql.SQLSyntaxErrorException: Table 'hikedu_default.ACT_GE_PROPERTY' doesn't exist
org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Table 'hikedu_default.ACT_GE_PROPERTY' doesn't exist
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Property.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: java.sql.SQLSyntaxErrorException: Table 'hikedu_default.ACT_GE_PROPERTY' doesn't exist

If i change the datasource of second engine to another mysql instance then camunda work all right.
New datasource config is (The port changed to 33306 that is a new mysql instance)

datasource:
url: jdbc:mysql://localhost:33306/hikedu_default?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT&zeroDateTimeBehavior=CONVERT_TO_NULL
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
initialization-mode: never

I was think camunda will create the tables of itself to the hikedu_default database but camunda did not. This make me confused.

Thanks you all. Please help me.

Hi @himly,

The exception says that the Camunda tables don’t exist in the schema you specified. You must create them before you start the engine. The scripts can be found in the Camunda distributions.

Cheers,
Thorben

Hi @thorben ,

Thank you for your reply that is helped me so much.
But I still have a question about camunda.

I was think the camunda will create the tables automally if the tables is not exists in the database.
For make sure I am not wrong about this I test a lot. And finally I find camunda will not create the tables automally at the two schema of same database but will create the table automally only in one schema for each database.

So my question is why camunda will not create tables automally in two schema of same database.
And how I can do for make sure camunda will create tables in two schema of same database automally.
Thans you.

2 Likes

Hi

I have the same problem. Several camunda instances on the same postgres database, but with different schemas. The first spring boot camunda starts fine, the second gets the error which is mentioned above.

Did you find a solution to this problem?

Br

Frank

Yes. I was find the solution but that is not a good solution but any way that solved the promble.
Here is the solution
1.download the script of create tables from camunda doc
2.Run the script to each shema.

After the above steps done. Each schema will has the tables of camunda.
Becaue you created the tables before start your application So the application will not create them And will not throw error.

How to make sure camunda will automally create the tables to each shema ?
I am not find the answer.
But i know why the camunda will not create the tables to Each shema.
I was read a lot source code of camunda.
I find the canunda will search whole database that mean all shema to find out the tables is or not created.

When you only have one shema that is ok.
But if you have two or more then the camunda will throw you an error.

Imagen you have two shemas And the tables did not created to them.
When you start your application the camunda will seach all shema to find out tables is or not exist.
The answer is false then the camunda will create them to your first shema.
After This done the camunda will search whole shema again for to create them to your second shema.
But at This time the answer is true then the camunda will ignore your second shema.

And the camunda will send query to your two schema
The first will not throw error because the tables is exist the sql is not wrong.
When send query to your second schema the mybatis will throw error because the tables of camunda did not exist in your second schema.

And you are welcome. I am glad to helo you.
By the way my english is So bad forgive me please.

Many thanks for your help!

Then we will see how we should solve this. Making the schemas manually could be the solution, but, we are using openshift, and the we will have to remake them manually each time.

Br

Frank

My english is so bad so I am not able to report this bug to camunda. But I hope someone will report this bug to camunda.
I think the final solution is camunda will take care this issue and fix it.

Br.

Hi @FrankReneSorensen
Someone helped me fixed this promble.

Here is the link

Thankyou as this article was helpful for me also and using nullDatabaseMeansCurrent=true resolved my issue

1 Like