Hi Siddhesh,

The easiest approach is to put the logic you want to run in a subclass of
AbstractIsisSessionTemplate [1], and then instantiate and execute it from
your quartz job.

This technique is used by the Incode Platform's quartz job to run
background commands, [2].

HTH Dan

[1]
http://isis.apache.org/guides/ugbtb/ugbtb.html#_ugbtb_headless-access_AbstractIsisSessionTemplate

[2]
https://github.com/incodehq/incode-platform/blob/master/modules/spi/command/impl/src/main/java/org/isisaddons/module/command/dom/BackgroundCommandExecutionFromBackgroundCommandServiceJdo.java


On Sun, 24 Sep 2017 at 13:12 <[email protected]> wrote:

> Hi,
>
>
>      I have implemented apache isis quartz in my application for
> scheduler. The scheduler works fine. But when i try to inject any
> service into the MyJob class(which implements Job), it throws NPE when
> using the service object.
>
>      For example, lets say i have a DemoService and it has a method
> foobar(). If i inject the service
>
> @Inject
> DemoService demoService;
>
>
> and then try to use it in executed() as following
>
> demoService.foobar()
>
> It throws Null Pointer Exception.
>
>
> What can i do to inject service in my Job class??
>
>
> Thanks,
> Siddhesh Phatak
>

Reply via email to