How to setup Tomcat so to use mysql for ALL Flowable UI applications

Dear all,

I am new to Java, Tomcat, MySQL and Flowable, so please bear with me.

I don’t have luck in making Tomcat to use MySQL for all Flowable UI applications. (Follow the section 2,3 of the doc, I am able to get that Java command line app to use mysql.)

Machine: (Virtual Machine) Linux Mint 18.2 (based on Ubuntu 16.04)
Flowable: 6.3.1
Tomcat: Version 8.5.31
Java: 8
MySQL: Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper (install via: sudo apt install tomcat-server at terminal)
MySQL Connector/J : Version 8.0.11 (download from mysql.com)
(Install Tomcat using this method, but skip step 2 and 4.)

In section 3.4.1 Database configuration, it says instead of going into each WAR, modify the content and rebuild WAR, it is better to do it at Tomcat. According to doc, I should modify this file: $CATALINA_BASE/conf/Catalina/localhost/flowable-app.xml

Seeing this, I create a flowable-modeler.xml and have the following content:

<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="true" path="/flowable-modeler">
    <Resource auth="Container"
        name="jdbc/flowableDB"
        type="javax.sql.DataSource"
        description="JDBC DataSource"
        url="jdbc:mysql://localhost:3306/flowable_modeler?autoReconnect=true&amp;useSSL=false"
        driverClassName="com.mysql.jc.jdbc.Driver"
        username="root"
        password="password"
        defaultAutoCommit="false"
        initialSize="5"
        maxWait="5000"
        maxActive="120"
        maxIdle="5"/>
</Context>
  1. [Context] Instead of “anitJARLocking”, I use “antiResourceLocking” as Tomcat version is now 8.
  2. [Context] Path is updated.
  3. [Resource URL] A database is created for modeler.
  4. [Resource URL] Disable SSL.
  5. [Resource driverClassName] Update JDBC driver to be “com.mysql.jc.jdbc.Driver”.
  6. I have another 4 XML files with each one for each Flowable UI application.

I then start tomcat (sudo systemctl start tomcat), I get:
WARNING [localhost-startStop-1] org.apache.naming.NamingContext.lookup Unexpected exception resolving reference java.sql.SQLException: Cannot load JDBC driver class ‘com.mysql.jc.jdbc.Driver’

And then I get stuck in:
INFO 20310 — [ost-startStop-1] liquibase : Waiting for changelog lock…

Is there almost a step by step procedure on how to make those Flowable UI applictions to use MySQL? I know that one can modify the application.properties file (as stated in 14.1 of the doc), but that is for each application. I want an solution that is for the site level. Thank you.

Hi,

I think the easiest way with 6.3.1 is to create a folder named ‘config’ in tomcat’s ‘lib’ folder, and create an ‘application.properties’ file there containing something like:

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

As the application.properties in that location is taken by all apps.

Cheers
Paul.

1 Like

I’ve been reminded that you also need to add the mysql jdbc driver jar into Tomcat’s lib. Also, you can just put the application.properties directly in Tomcat’s lib (without the config subfolder).

Cheers
Paul.

Hi Paul,

I just try. I have put the driver in the lib directory. As for the application.properties file, I find out it works only when in the config directory within lib directory. (That is, tomcat directory\lib\config\application.properties.) If I check on the log, when the file is inside the config directory, the catalina.out (in tomcat’s logs directory) says it creates those flowable ACT_* tables. When the file is just in the lib directory, the catalina.out says it still uses the H2 database.

Thanks for your help.

Hi,

Thanks for the feedback. I tested putting application.properties directly in tomcat/lib with 6.3.1 and it works for me. I think with 6.3.0 it only worked with the config subfolder.

Cheers
Paul.