Change from h2 db to mysql db

Hello,

I am new to Flowable and BPMN. I could set up properly flowable-ui and flowable-rest with the by-default configuration using Apache Tomcat.

My aim is to be able to use flowable-ui to design my processes and apps, and then to interact with them using the REST-API. To achieve this, I would like to make the webapps (in tomcat) “flowable-ui” and “flowable-rest” point to the same mysql database that I created and called “flowable”.

I also created a mysql user named flowable with password flowable as required in the doc.

Then, I tried to link flowable-ui to this mysql db, then if it worked, I would have done the same with flowable-rest.

To do this, I changed the following lines in tomcat/webapps/flowable-ui/WEB-INF/classes/flowable-default.properties as indicated in the doc that I studied:

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flowable?characterEncoding=UTF-8
spring.datasource.username=flowable
spring.datasource.password=flowable

I also added the jar file of mysql connector first in tomcat/webapps/flowable-ui/WEB-INF/lib, then I moved it to tomcat/lib.

However, I always get HTTP Status 404 - Not Found for localhost:8080/flowable-ui/ which only works for the by-default h2 database.

What did I forget in my configuration ?

Best regards

Hello.

Here’s the solution: Spring Boot integration with a differnet database - #2 by fiki574

EDIT:
My bad, you don’t have a standalone Spring Boot application, you would rather override the properties for the default database connection of the Flowable instance.

I use Docker, and here’s how I did it there:
SPRING_DATASOURCE_DRIVER-CLASS-NAME: org.postgresql.Driver
SPRING_DATASOURCE_URL: jdbc:postgresql://flowable-postgres:5432/flowable
SPRING_DATASOURCE_USERNAME: flowable
SPRING_DATASOURCE_PASSWORD: flowable

So the properties you’re overriding are correct, however it might be at a “wrong location” in the file system.

Thank you for your answer. Indeed, I intentionnally do not use Docker. I cannot make this work, as I have read all similar topics on this forum and documentation sections related to my topic. As you, I think it might be a tiny mistake, but I have no clue how to find it.

Hi,

try to put a application.properties file containing the datasource properties in the tomcat/lib folder.
This prevents issues with overwriting while expanding the current one.
It also has a higher class loading hierarchy.

Regards

Yvo

1 Like

Hi,

Thank you a lot for your suggestion. Actually, I read this potential fix in a similar topic, but it does not change the 404 output (I obviously stopped and restarted the apache tomcat to apply the changes).

Can you provide the logging of Tomcat / Flowable booting?

Yes, here are what I think the relevant parts of the log:
Caused by: java.sql.SQLSyntaxErrorException: Access denied for user ‘flowable’@‘localhost’ to database ‘flowable’
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)

Caused by: java.lang.RuntimeException: Exception while initializing Database connection

I think I should try to give rights to this user, but since I already have granted all privileges to it, I must think about it.

that could be the cause of the issue :wink:

You’re right… The flowable user needs to have to required permissions.

I flushed the privileges to update the rights, but still no luck. There is another error appearing in the log though, that states that a bean could not be built. However, unfortunately, I cannot spend more time trying to debug this. Thank you for your time !

Hello, I am back to solve the problem.

So, it still does not work and here are the detailed useful log portions of catalina (in my opinion):

SEVERE [main] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/home/charline/Downloads/apache-tomcat-9.0.44/webapps/flowable-ui.war] java.lang.IllegalStateException: Error starting child [...] Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/flowable-ui]] [...] Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'idmSecurityConfiguration': Unsatisfied dependency expressed through field 'identityService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'idmIdentityService' defined in class path resource [org/flowable/spring/boot/idm/IdmEngineServicesAutoConfiguration.class]: Unsatisfied dependency expressed through method 'idmIdentityService' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'idmEngine' defined in class path resource [org/flowable/spring/boot/idm/IdmEngineServicesAutoConfiguration$AlreadyInitializedAppEngineConfiguration.class]: Unsatisfied dependency expressed through method 'idmEngine' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowableAppEngine': FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: Error initialising eventregistry data model [...] Caused by: org.flowable.common.engine.api.FlowableException: Error updating eventregistry engine tables [...] Caused by: java.lang.ClassCastException: class java.time.LocalDateTime cannot be cast to class java.lang.String (java.time.LocalDateTime and java.lang.String are in module java.base of loader 'bootstrap')

I think the relevant part are Error initialising eventregistry data model and Error updating eventregistry engine tables. No other log portion evokes something about mysql or more generally, database-related.

Does anyone know how to fix this problem ?

Thank you a lot in advance.

Hi,

was the db scheme instantiated by Liquibase on Flowable bootup?
Or did you; because of the previous issues; create them using the db scripts?

Yvo

Hello,
Thank you for your quick answer. I did not do anything manually other than change the db properties as stated in the first message of this thread and create a flowable db, and a flowable user db on mysql. I did not use any db script.
Should I instanciate the db scheme, if yes how ? With which scripts ?

Best regards

Perhaps this is causing it;

have a look here Upgrade mysql-jdbc-drivers 8.0.23, liquibase threw exceptions · Issue #2836 · flowable/flowable-engine · GitHub

(use mysql driver version 8.0.22)

Regards,

Yvo