Discussion:
BatchRuntime.getJobOperator() returns null on TomEE 7.0.4
Ruben S
2018-04-20 14:36:38 UTC
Permalink
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
r***@das.nl
2018-04-20 14:25:03 UTC
Permalink
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("naam") String naam) {
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
Disclaimer Deze e-mail is uitsluitend bestemd voor de geadresseerde(n). Als u dit bericht onbedoeld heeft ontvangen verzoeken wij u het te vernietigen en de afzender te informeren. Gebruik door derden of openbaarmaking van dit bericht zonder toestemming van DAS is niet toegestaan.
DAS Nederlandse Rechtsbijstand Verzekeringmaatschappij N.V. (KvK 33110754), DAS Legal Services B.V. (KvK 34283906) en DAS Legal Finance B.V. (KvK 34251232) zijn statutair gevestigd te Amsterdam.
Romain Manni-Bucau
2018-04-21 10:37:35 UTC
Permalink
Hi

Do you use tomee+? It is the only one where it works.
Post by Ruben S
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
@GET
@Path("/batch/start/{name}")
@Produces(MediaType.TEXT_XML)
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
Disclaimer Deze e-mail is uitsluitend bestemd voor de geadresseerde(n).
Als u dit bericht onbedoeld heeft ontvangen verzoeken wij u het te
vernietigen en de afzender te informeren. Gebruik door derden of
openbaarmaking van dit bericht zonder toestemming van DAS is niet
toegestaan.
DAS Nederlandse Rechtsbijstand Verzekeringmaatschappij N.V. (KvK
33110754), DAS Legal Services B.V. (KvK 34283906) en DAS Legal Finance B.V.
(KvK 34251232) zijn statutair gevestigd te Amsterdam.
Loading...