Hi,

I am trying to start a batch job on TomEE 7.0.4 from a REST controller. I
have defined a batch job in an XML file in META-INF/batch-jobs, and also
have an ItemReader, ItemProcessor, and ItemWriter. But I am not able to
start the job from a REST controller, using the following code:

    @GET
    @Path("/batch/start/{name}")
    @Produces(MediaType.TEXT_XML)
    public String startBatchJob(@PathParam("name") String name) {
        JobOperator jobOperator = BatchRuntime.getJobOperator();
        LOG.info("jobOperator = {}", jobOperator);
        long executionId = jobOperator.start(name, new Properties());
        return String.format("<executionId>%s</executionId>", executionId);
    }

It does not work because jobOperator is null.
The same applies when the job is started as a background job using
@Schedule. 
Then again, BatchRuntime.getJobOperator() returns null.
Any ideas?

Ruben



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Reply via email to