Skip to content

Spring boot 2.6.0 Quartz mysql/mariadb tables are not created #29095

@chrisdev0

Description

@chrisdev0

In spring boot 2.6.1 the creation of the Quartz tables for (at least) mysql and mariadb have stopped working.

The cause is that the spring.quartz.jdbc.comment-prefix property isn't used on the way to the runScripts method in DataSourceScriptDatabaseInitializer so the ResourceDatabasePopulator is never configured with these comment-prefixes.

This causes the default comment-prefixes to be used (which is --) and since the org.quartz-scheduler:quartz:2.3.2 dependency mysql/mariadb sql files (in org.quartz.impl.jdbcjobstore) have non -- prefixed comments the results is broken sql.

The exception is then silently ignored (unless debug log level) due to continueOnError being true.

A temporary solution is to extract the .sql-file in the org.quartz-scheduler:quartz dependency, remove the # comments on top and then overriding the schema used to initialize the quartz tables by using the property spring.quartz.jdbc.schema

I've created a small example of the bug here https://github.com/chrisdev0/quartz-bug
run with default profile results in error on startup due to
Caused by: java.sql.SQLException: Table 'quartz_bug.qrtz_locks' doesn't exist
run with workaround profile and it will start since it's using the extracted schema sql file with the comments removed

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions