Home The Job must not be null when launching Spring batch job async in grails
Reply: 0

The Job must not be null when launching Spring batch job async in grails

user1316
1#
user1316 Published in June 19, 2018, 2:41 pm

I have a grails 2.5.5 project running the Spring batch job grails plugin. This problem raised when deploying the app to another environment because in local it works perfectly.

When I try to launch my job it says: The job must not be null.

This is my plugin config

plugin {
    springBatch {
        jmx {
            enable = false
            remote {
                enable = false
            }
        }
        loadTables = true
        database = 'mysql'
    }
}

This is basically my spring batch job config

beans {
    batch.job(id: 'myJob', restartable: true) {
        batch.step(id: 'myStep') {
            batch.tasklet {
                batch.chunk(
                        reader: 'myReader',
                        processor: 'myItemProcessor',
                        writer: 'myWriter',
                        'commit-interval': 1000
                )
            }
        }
    }
}

In my service y get the bean just doing

    def myJob

And then I launch it

JobExecution exec = jobLauncher.run(myJob, builder.toJobParameters())

So there is a problem when launching my job because the bean "myJob" is not autowired. Any ideas??

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.419183 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO