NullPointerException updating schema

Hi,
We are running Flowable (6.3.1.0) embedded in a Spring Boot app, and everything works fine when running locally for development, but we’ve just tried to deploy it into AWS (using Aurora in MySQL 5.6 mode - we use MySQL 5.6 for local dev), and we get a very strange error on startup:

Caused by: java.lang.NullPointerException: null
    at org.flowable.engine.impl.db.ProcessDbSchemaManager.dbSchemaUpdate(ProcessDbSchemaManager.java:184)
    at org.flowable.engine.impl.db.ProcessDbSchemaManager.performSchemaOperationsProcessEngineBuild(ProcessDbSchemaManager.java:339)
    at org.flowable.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:28)
    at org.flowable.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:51)
    at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:93)
    at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72)
    at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56)
    at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25)
    at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
    at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:71)
    at org.flowable.idm.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:49)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.flowable.idm.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:46)
    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.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:78)
    at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:857)
    at org.flowable.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:81)
    at org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:60)
    at org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
    ... 50 common frames omitted

I can confirm that the ACT_GE_PROPERTY table does not contain a row for schema.version. Full contents of the table are:

‘common.schema.version’, ‘6.3.1.0’, ‘1’
‘identitylink.schema.version’, ‘6.3.1.0’, ‘1’
‘job.schema.version’, ‘6.3.1.0’, ‘1’
‘next.dbid’, ‘1’, ‘1’
‘task.schema.version’, ‘6.3.1.0’, ‘1’
‘variable.schema.version’, ‘6.3.1.0’, ‘1’

If I run our app locally on a dev machine, it starts up fine and schema.version reports correctly as 6.3.1.0.

It’s almost as though the initial schema creation/update on startup failed part way through…? The code (see ProcessDbSchemaManager line 184) clearly does not expect the version property to be nullable.

Can anyone provide any insight into how the schema could get into this state?

Thanks,
Shannon

We’ve managed to narrow down the problem to the following bit of SQL from flowable.mysql.create.engine.sql:

create table ACT_EVT_LOG (
    LOG_NR_ bigint auto_increment,
    TYPE_ varchar(64),
    PROC_DEF_ID_ varchar(64),
    PROC_INST_ID_ varchar(64),
    EXECUTION_ID_ varchar(64),
    TASK_ID_ varchar(64),
    TIME_STAMP_ timestamp(3) not null,
    USER_ID_ varchar(255),
    DATA_ LONGBLOB,
    LOCK_OWNER_ varchar(255),
    LOCK_TIME_ timestamp(3) null,
    IS_PROCESSED_ tinyint default 0,
    primary key (LOG_NR_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;

The error that comes back from Aurora:

Invalid default value for 'TIME_STAMP_'

This obviously works fine on MySQL, and we can make it work by tweaking the DDL to include a default value of now(3) on the TIME_STAMP_ field, but this raises a few questions:

  1. Is this a bug? Is Aurora something that you aim to support? We suspect that this is an Aurora bug, and we’re chasing up with AWS, but as things stand right now, Flowable won’t run on Aurora.
  2. Would you be open to specifying default values on timestamp fields to make this work on both MySQL and Aurora?
  3. How did you manage to run your 6.3.0 benchmarks back in March on Aurora?
  1. It does look like it indeed.
  2. Yes, for sure.
  3. Good question. I don’t recall any changes needed wrt the schema. Maybe something changed in the meantime on Aurora, it was pointing to the right jdbc url (https://github.com/flowable/flowable-benchmark/blob/master/2018-03/src/main/resources/example-config.properties#L2) and just run it.

We’ll look into it and post back here.

Some more info:

You can resolve this issue by switching the MySQL/Aurora sql_mode server/instance parameter from the default ‘TRADITIONAL’ to 0 on Aurora. This is the feedback we received from AWS. We’ve tested this and it does indeed resolve the issue.

However, I’d argue that the more portable solution that doesn’t require users to tweak their DB settings is just to provide a default value for this column, especially considering that it’s a timestamp on an event, so CURRENT_TIMESTAMP probably makes sense anyway. This appears to be the only column in the Flowable schema that suffers from this problem, so the change seems minimal.

Hi,

While trying to run the springboot jar on server with oracle i get following error. Note on local machine it works well.

Caused by: java.lang.NullPointerException
at org.flowable.engine.impl.db.ProcessDbSchemaManager.schemaUpdate(ProcessDbSchemaManager.java:185) ~[flowable-engine-6.4.1.jar!/:6.4.1]
at org.flowable.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:54) ~[flowable-engine-6.4.1.jar!/:6.4.1]
at org.flowable.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:28) ~[flowable-engine-6.4.1.jar!/:6.4.1]
at org.flowable.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:51) ~[flowable-engine-6.4.1.jar!/:6.4.1]
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:93) ~[flowable-engine-6.4.1.jar!/:6.4.1]
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72) ~[flowable-engine-6.4.1.jar!/:6.4.1]
at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56) ~[flowable-engine-6.4.1.jar!/:6.4.1]

Can anyone please suggest the solution ??