flowable / flowable-engine

A compact and highly efficient workflow and Business Process Management (BPM) platform for developers, system admins and business users.
https://www.flowable.org
Apache License 2.0
7.85k stars 2.59k forks source link

Liquibase first up does not work with JtaProcessEngineConfiguration #3911

Closed Sbruk closed 3 months ago

Sbruk commented 3 months ago

Hello flowable team,

Describe the bug When starting our application with a flowable engine using a JtaProcessEngineConfiguration and the property databaseSchemaUpdate=true on a brand new empty schema, the liquibase scripts fail with the following error, while it works properly with StandaloneProcessEngineConfiguration:

2024-06-17 09:03:18,216 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) Found 2 Engine Configurators in total:
2024-06-17 09:03:18,216 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) class org.flowable.eventregistry.impl.configurator.EventRegistryEngineConfigurator (priority:100000)
2024-06-17 09:03:18,217 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) class org.flowable.idm.engine.configurator.IdmEngineConfigurator (priority:150000)
2024-06-17 09:03:18,217 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) Executing beforeInit() of class org.flowable.eventregistry.impl.configurator.EventRegistryEngineConfigurator (priority:100000)
2024-06-17 09:03:18,235 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) Executing beforeInit() of class org.flowable.idm.engine.configurator.IdmEngineConfigurator (priority:150000)
2024-06-17 09:03:18,270 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) Configuring Datasource with following properties (omitted password for security)
2024-06-17 09:03:18,270 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) datasource driver : org.postgresql.Driver
2024-06-17 09:03:18,271 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) datasource url : jdbc:postgresql://localhost:5432/postgres?currentSchema=flowable
2024-06-17 09:03:18,271 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) datasource user name : postgres
2024-06-17 09:03:19,100 INFO  [org.flo.com.eng.imp.asy.DefaultAsyncTaskExecutor] (Quarkus Main Thread) Creating thread pool queue of size 100
2024-06-17 09:03:19,100 INFO  [org.flo.com.eng.imp.asy.DefaultAsyncTaskExecutor] (Quarkus Main Thread) Creating thread factory with naming pattern flowable-async-task-invoker-thread-%d
2024-06-17 09:03:19,101 INFO  [org.flo.com.eng.imp.asy.DefaultAsyncTaskExecutor] (Quarkus Main Thread) Creating executor service with corePoolSize 8, maxPoolSize 8 and keepAliveTime 5000
2024-06-17 09:03:19,101 INFO  [org.flo.com.eng.imp.asy.DefaultAsyncTaskExecutor] (Quarkus Main Thread) Using rejectedExecutionHandler java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy@3cb585fa
2024-06-17 09:03:19,102 INFO  [org.flo.com.eng.imp.asy.DefaultAsyncTaskExecutor] (Quarkus Main Thread) Creating thread pool queue of size 2048
2024-06-17 09:03:19,102 INFO  [org.flo.com.eng.imp.asy.DefaultAsyncTaskExecutor] (Quarkus Main Thread) Creating thread factory with naming pattern flowable-async-job-executor-thread-%d
2024-06-17 09:03:19,102 INFO  [org.flo.com.eng.imp.asy.DefaultAsyncTaskExecutor] (Quarkus Main Thread) Creating executor service with corePoolSize 8, maxPoolSize 8 and keepAliveTime 5000
2024-06-17 09:03:19,104 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) Executing configure() of class org.flowable.eventregistry.impl.configurator.EventRegistryEngineConfigurator (priority:100000)
2024-06-17 09:03:19,161 INFO  [org.flo.com.eng.imp.db.CommonDbSchemaManager] (Quarkus Main Thread) performing create on common with resource org/flowable/common/db/create/flowable.postgres.create.common.sql
2024-06-17 09:03:19,362 INFO  [liq.database] (Quarkus Main Thread) Set default schema name to flowable
2024-06-17 09:03:19,684 INFO  [liq.changelog] (Quarkus Main Thread) Creating database history table with name: flowable.flw_ev_databasechangelog
2024-06-17 09:03:19,717 INFO  [liq.changelog] (Quarkus Main Thread) Reading from flowable.flw_ev_databasechangelog
2024-06-17 09:03:19,813 INFO  [liq.lockservice] (Quarkus Main Thread) Successfully acquired change log lock
2024-06-17 09:03:19,815 INFO  [liq.command] (Quarkus Main Thread) Using deploymentId: 8607799815
2024-06-17 09:03:19,818 INFO  [liq.changelog] (Quarkus Main Thread) Reading from flowable.flw_ev_databasechangelog
Running Changeset: org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml::1::flowable
2024-06-17 09:03:19,860 INFO  [liq.changelog] (Quarkus Main Thread) Table FLW_EVENT_DEPLOYMENT created
2024-06-17 09:03:19,868 INFO  [liq.changelog] (Quarkus Main Thread) Table FLW_EVENT_RESOURCE created
2024-06-17 09:03:19,877 INFO  [liq.changelog] (Quarkus Main Thread) Table FLW_EVENT_DEFINITION created
2024-06-17 09:03:19,881 INFO  [liq.changelog] (Quarkus Main Thread) Index ACT_IDX_EVENT_DEF_UNIQ created
2024-06-17 09:03:19,892 INFO  [liq.changelog] (Quarkus Main Thread) Table FLW_CHANNEL_DEFINITION created
2024-06-17 09:03:19,898 INFO  [liq.changelog] (Quarkus Main Thread) Index ACT_IDX_CHANNEL_DEF_UNIQ created
2024-06-17 09:03:19,902 INFO  [liq.changelog] (Quarkus Main Thread) ChangeSet org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml::1::flowable ran successfully in 55ms
Running Changeset: org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml::2::flowable
2024-06-17 09:03:19,918 INFO  [liq.changelog] (Quarkus Main Thread) Columns TYPE_(varchar(255)) added to FLW_CHANNEL_DEFINITION
2024-06-17 09:03:19,921 INFO  [liq.changelog] (Quarkus Main Thread) Columns IMPLEMENTATION_(varchar(255)) added to FLW_CHANNEL_DEFINITION
2024-06-17 09:03:19,924 INFO  [liq.changelog] (Quarkus Main Thread) ChangeSet org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml::2::flowable ran successfully in 11ms
Running Changeset: org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml::3::flowable
2024-06-17 09:03:19,968 INFO  [liq.changelog] (Quarkus Main Thread) Set Channel Definition type and implementation columns
2024-06-17 09:03:19,971 INFO  [liq.changelog] (Quarkus Main Thread) ChangeSet org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml::3::flowable ran successfully in 39ms

UPDATE SUMMARY
Run:                          3
Previously run:               0
Filtered out:                 0
-------------------------------
Total change sets:            3

2024-06-17 09:03:19,982 INFO  [liq.util] (Quarkus Main Thread) UPDATE SUMMARY
2024-06-17 09:03:19,982 INFO  [liq.util] (Quarkus Main Thread) Run:                          3
2024-06-17 09:03:19,982 INFO  [liq.util] (Quarkus Main Thread) Previously run:               0
2024-06-17 09:03:19,982 INFO  [liq.util] (Quarkus Main Thread) Filtered out:                 0
2024-06-17 09:03:19,982 INFO  [liq.util] (Quarkus Main Thread) -------------------------------
2024-06-17 09:03:19,983 INFO  [liq.util] (Quarkus Main Thread) Total change sets:            3
2024-06-17 09:03:19,984 INFO  [liq.util] (Quarkus Main Thread) Update summary generated
2024-06-17 09:03:19,986 INFO  [liq.command] (Quarkus Main Thread) Update command completed successfully.
Liquibase: Update has been successful. Rows affected: 3
2024-06-17 09:03:19,994 INFO  [liq.lockservice] (Quarkus Main Thread) Successfully released change log lock
2024-06-17 09:03:19,997 INFO  [liq.command] (Quarkus Main Thread) Command execution complete
2024-06-17 09:03:19,999 INFO  [org.flo.eve.imp.EventRegistryEngineImpl] (Quarkus Main Thread) EventRegistryEngine default created
2024-06-17 09:03:20,005 INFO  [org.flo.eng.imp.cfg.JtaProcessEngineConfiguration] (Quarkus Main Thread) Executing configure() of class org.flowable.idm.engine.configurator.IdmEngineConfigurator (priority:150000)
2024-06-17 09:03:20,024 INFO  [org.flo.idm.eng.imp.db.IdmDbSchemaManager] (Quarkus Main Thread) performing create on identity with resource org/flowable/idm/db/create/flowable.postgres.create.identity.sql
2024-06-17 09:03:20,106 INFO  [org.flo.idm.eng.imp.IdmEngineImpl] (Quarkus Main Thread) IdmEngine default created
2024-06-17 09:03:20,134 INFO  [org.flo.ide.ser.imp.db.IdentityLinkDbSchemaManager] (Quarkus Main Thread) performing create on identitylink with resource org/flowable/identitylink/service/db/create/flowable.postgres.create.identitylink.sql
2024-06-17 09:03:20,168 INFO  [org.flo.ide.ser.imp.db.IdentityLinkDbSchemaManager] (Quarkus Main Thread) performing create on identitylink.history with resource org/flowable/identitylink/service/db/create/flowable.postgres.create.identitylink.history.sql
2024-06-17 09:03:20,205 INFO  [org.flo.ent.ser.imp.db.EntityLinkDbSchemaManager] (Quarkus Main Thread) performing create on entitylink with resource org/flowable/entitylink/service/db/create/flowable.postgres.create.entitylink.sql
2024-06-17 09:03:20,229 INFO  [org.flo.ent.ser.imp.db.EntityLinkDbSchemaManager] (Quarkus Main Thread) performing create on entitylink.history with resource org/flowable/entitylink/service/db/create/flowable.postgres.create.entitylink.history.sql
2024-06-17 09:03:20,257 INFO  [org.flo.eve.ser.imp.db.EventSubscriptionDbSchemaManager] (Quarkus Main Thread) performing create on eventsubscription with resource org/flowable/eventsubscription/service/db/create/flowable.postgres.create.eventsubscription.sql
2024-06-17 09:03:20,283 INFO  [org.flo.tas.ser.imp.db.TaskDbSchemaManager] (Quarkus Main Thread) performing create on task with resource org/flowable/task/service/db/create/flowable.postgres.create.task.sql
2024-06-17 09:03:20,306 INFO  [org.flo.tas.ser.imp.db.TaskDbSchemaManager] (Quarkus Main Thread) performing create on task.history with resource org/flowable/task/service/db/create/flowable.postgres.create.task.history.sql
2024-06-17 09:03:20,344 INFO  [org.flo.var.ser.imp.db.VariableDbSchemaManager] (Quarkus Main Thread) performing create on variable with resource org/flowable/variable/service/db/create/flowable.postgres.create.variable.sql
2024-06-17 09:03:20,373 INFO  [org.flo.var.ser.imp.db.VariableDbSchemaManager] (Quarkus Main Thread) performing create on variable.history with resource org/flowable/variable/service/db/create/flowable.postgres.create.variable.history.sql
2024-06-17 09:03:20,398 INFO  [org.flo.job.ser.imp.db.JobDbSchemaManager] (Quarkus Main Thread) performing create on job with resource org/flowable/job/service/db/create/flowable.postgres.create.job.sql
2024-06-17 09:03:20,587 INFO  [org.flo.bat.ser.imp.db.BatchDbSchemaManager] (Quarkus Main Thread) performing create on batch with resource org/flowable/batch/service/db/create/flowable.postgres.create.batch.sql
2024-06-17 09:03:20,607 INFO  [org.flo.eng.imp.db.ProcessDbSchemaManager] (Quarkus Main Thread) performing create on engine with resource org/flowable/db/create/flowable.postgres.create.engine.sql
2024-06-17 09:03:20,864 INFO  [org.flo.eng.imp.db.ProcessDbSchemaManager] (Quarkus Main Thread) performing create on history with resource org/flowable/db/create/flowable.postgres.create.history.sql
2024-06-17 09:03:20,960 INFO  [org.flo.eng.imp.ProcessEngineImpl] (Quarkus Main Thread) ProcessEngine default created
2024-06-17 09:03:20,965 INFO  [org.flo.job.ser.imp.asy.AbstractAsyncExecutor] (Quarkus Main Thread) Starting up the async job executor [org.flowable.job.service.impl.asyncexecutor.DefaultAsyncJobExecutor] for engine bpmn
2024-06-17 09:03:20,980 ERROR [org.flo.com.eng.imp.int.CommandContext] (Quarkus Main Thread) Error while closing command context: org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ru_job" does not exist
  Position: 39
### The error may exist in org/flowable/job/service/db/mapping/entity/Job.xml
### The error may involve org.flowable.job.service.impl.persistence.entity.JobEntityImpl.selectJobByQueryCriteria-Inline
### The error occurred while setting parameters
### SQL: SELECT RES.*                     from ACT_RU_JOB RES          WHERE  RES.LOCK_OWNER_ = ?                order by RES.ID_ asc
### Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ru_job" does not exist
  Position: 39
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:153)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
    at org.flowable.common.engine.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:276)
    at org.flowable.common.engine.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:239)
    at org.flowable.common.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:163)
    at org.flowable.job.service.impl.persistence.entity.data.impl.MybatisJobDataManager.findJobsByQueryCriteria(MybatisJobDataManager.java:113)
    at org.flowable.job.service.impl.persistence.entity.JobEntityManagerImpl.findJobsByQueryCriteria(JobEntityManagerImpl.java:72)
    at org.flowable.job.service.impl.cmd.UnacquireOwnedJobsCmd.execute(UnacquireOwnedJobsCmd.java:54)
    at org.flowable.job.service.impl.cmd.UnacquireOwnedJobsCmd.execute(UnacquireOwnedJobsCmd.java:25)
    at org.flowable.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:72)
    at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:176)
    at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:121)
    at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:77)
    at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:26)
    at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
    at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:105)
    at org.flowable.common.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:66)
    at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
    at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
    at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
    at org.flowable.job.service.impl.asyncexecutor.AbstractAsyncExecutor.unlockOwnedJobs(AbstractAsyncExecutor.java:81)
    at org.flowable.job.service.impl.asyncexecutor.DefaultAsyncJobExecutor.startAdditionalComponents(DefaultAsyncJobExecutor.java:111)
    at org.flowable.job.service.impl.asyncexecutor.AbstractAsyncExecutor.start(AbstractAsyncExecutor.java:105)
    at org.flowable.engine.impl.ProcessEngineImpl.startExecutors(ProcessEngineImpl.java:107)
    at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:877)

Expected behavior The liquibase scripts should work with JtaProcessEngineConfiguration.

Code N/A

Additional context Flowable 7.0.1 Quarkus 3.10.2 Postgres 16.1 Java temurin 17

Thanks in advance for your help!

Sbruk commented 3 months ago

Fixed with https://github.com/flowable/flowable-engine/issues/3910