You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by rb...@das.nl on 2018/04/20 14:25:03 UTC

BatchRuntime.getJobOperator() returns null on TomEE 7.0.4


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.  

Re: BatchRuntime.getJobOperator() returns null on TomEE 7.0.4

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

Do you use tomee+? It is the only one where it works.

Le 21 avr. 2018 11:57, <rb...@das.nl> a écrit :

>
>
> 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.
>