Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Quartz Tables in Bootstrap #97

Open
mrankin32 opened this issue Feb 7, 2018 · 0 comments
Open

Create Quartz Tables in Bootstrap #97

mrankin32 opened this issue Feb 7, 2018 · 0 comments

Comments

@mrankin32
Copy link

mrankin32 commented Feb 7, 2018

I am using quartz plugin version 2.0.12 and Grails 3.2.11 and I am wanting to create the required quartz tables in the bootstrap init with jdbcStore = true in the quartz config. I need to find a way to do this so when I clone an amazon instances of my application in AWS I don't have to manually create the quartz tables every time I clone the instance. The problem I am having is the the quartz plugin is initializing and trying to read from the QRTZ_JOB_DETAILS table before the table is even created in my bootstrap so the application fails to run with the following stacktrace:

`[02/07/2018 15:49:21] ERROR : org.springframework.boot.SpringApplication : Application startup failed
org.quartz.JobPersistenceException: Couldn't obtain job names: Table "QRTZ_JOB_DETAILS" not found; SQL statement:
SELECT JOB_NAME, JOB_GROUP FROM QRTZ_JOB_DETAILS WHERE SCHED_NAME = 'quartzScheduler' AND JOB_GROUP LIKE ? [42102-194]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.getJobNames(JobStoreSupport.java:1889)
...
at org.quartz.impl.jdbcjobstore.JobStoreSupport.getJobNames(JobStoreSupport.java:1887)
... 35 more

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':bootRun'.`

My bootstrap looks like this:
`
class BootStrap {

def dataSource

def init = { servletContext ->

        def queries = []

        queries.add("CREATE TABLE if not exists qrtz_job_details ( " +
                "SCHED_NAME VARCHAR(120) NOT NULL," +
                "JOB_NAME VARCHAR(200) NOT NULL," +
                "JOB_GROUP VARCHAR(200) NOT NULL," +
                "DESCRIPTION VARCHAR(250) NULL," +
                "JOB_CLASS_NAME VARCHAR(250) NOT NULL," +
                "IS_DURABLE BOOLEAN NOT NULL," +
                "IS_NONCONCURRENT BOOLEAN NOT NULL," +
                "IS_UPDATE_DATA BOOLEAN NOT NULL," +
                "REQUESTS_RECOVERY BOOLEAN NOT NULL," +
                "JOB_DATA BINARY NULL," +
                "PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)" +
                ");")

        Sql sql = new Sql(dataSource)

        queries.each { query ->
            sql.execute(query)
        }

       sql.close()

}

}
`

Is there a way to automatically generate the quartz tables in any way without manual intervention?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant