Configuring Quartz under TomEE

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Configuring Quartz under TomEE

Ihsan Ecemis-2

Hello Everyone,

We would like to store Quartz scheduling information within a relational database. We tried different configuration options to use our own properties file instead of TomEE's default, but could not get it to work.

Here are the things we tried:

(1) We defined the system property 'org.quartz.properties', e.g. did "-Dorg.quartz.properties=/tmp/quartz.properties".
(2) Since TomEE shades org.quartz, we also tried "-Dorg.apache.openejb.quartz.properties=/tmp/quartz.properties".
(3) We also tried configuring this via web.xml file by adding:

  <context-param>
    <param-name>quartz:config-file</param-name>
    <param-value>/tmp/quartz.properties</param-value>
  </context-param>


In all these cases, even though we set org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX (or org.apache.openejb.quartz.jobStore.class = org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreTX) and adjust all parameters as documented at Quartz User Guide,  TomEE is initializing RAMJobStore instead of JobStoreTX.  Also, there is no indication in the logs that Quartz is opening our properties file.

How can we configure Quartz under TomEE?

Any help would be greatly appreaciated.

Thanks,

Ihsan.
Reply | Threaded
Open this post in threaded view
|

Re: Configuring Quartz under TomEE

jgallimore
TomEE uses Quartz internally to schedule EJB timers etc - the reason for
shading it is to avoid it conflicting with Quartz packaged in your
application. So theoretically, you should be able to package Quartz in your
application, and use it per its own documentation. If you have a code
sample with your issue that you can provide us with, we'd be happy to take
a look.

Cheers

Jon

On Fri, Dec 20, 2019 at 4:13 AM Ihsan Ecemis <[hidden email]> wrote:

>
> Hello Everyone,
>
> We would like to store Quartz scheduling information within a relational
> database. We tried different configuration options to use our own
> properties file instead of TomEE's default, but could not get it to work.
>
> Here are the things we tried:
>
> (1) We defined the system property 'org.quartz.properties', e.g. did
> "-Dorg.quartz.properties=/tmp/quartz.properties".
> (2) Since TomEE shades org.quartz, we also tried
> "-Dorg.apache.openejb.quartz.properties=/tmp/quartz.properties".
> (3) We also tried configuring this via web.xml file by adding:
>
>   <context-param>
>     <param-name>quartz:config-file</param-name>
>     <param-value>/tmp/quartz.properties</param-value>
>   </context-param>
>
>
> In all these cases, even though we set org.quartz.jobStore.class =
> org.quartz.impl.jdbcjobstore.JobStoreTX (or
> org.apache.openejb.quartz.jobStore.class =
> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreTX) and adjust all
> parameters as documented at Quartz User Guide,  TomEE is initializing
> RAMJobStore instead of JobStoreTX.  Also, there is no indication in the
> logs that Quartz is opening our properties file.
>
> How can we configure Quartz under TomEE?
>
> Any help would be greatly appreaciated.
>
> Thanks,
>
> Ihsan.
Reply | Threaded
Open this post in threaded view
|

Re: Configuring Quartz under TomEE

Richard Monson-Haefel
In reply to this post by Ihsan Ecemis-2
You probably tried this but I was going to suggest a Custom Resource.
http://tomee.apache.org/application-resources.html

On Thu, Dec 19, 2019 at 10:13 PM Ihsan Ecemis <[hidden email]> wrote:

>
> Hello Everyone,
>
> We would like to store Quartz scheduling information within a relational
> database. We tried different configuration options to use our own
> properties file instead of TomEE's default, but could not get it to work.
>
> Here are the things we tried:
>
> (1) We defined the system property 'org.quartz.properties', e.g. did
> "-Dorg.quartz.properties=/tmp/quartz.properties".
> (2) Since TomEE shades org.quartz, we also tried
> "-Dorg.apache.openejb.quartz.properties=/tmp/quartz.properties".
> (3) We also tried configuring this via web.xml file by adding:
>
>   <context-param>
>     <param-name>quartz:config-file</param-name>
>     <param-value>/tmp/quartz.properties</param-value>
>   </context-param>
>
>
> In all these cases, even though we set org.quartz.jobStore.class =
> org.quartz.impl.jdbcjobstore.JobStoreTX (or
> org.apache.openejb.quartz.jobStore.class =
> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreTX) and adjust all
> parameters as documented at Quartz User Guide,  TomEE is initializing
> RAMJobStore instead of JobStoreTX.  Also, there is no indication in the
> logs that Quartz is opening our properties file.
>
> How can we configure Quartz under TomEE?
>
> Any help would be greatly appreaciated.
>
> Thanks,
>
> Ihsan.



--
Richard Monson-Haefel
https://twitter.com/rmonson
https://www.linkedin.com/in/monsonhaefel/
Reply | Threaded
Open this post in threaded view
|

Re: Configuring Quartz under TomEE

Ihsan Ecemis-2
In reply to this post by jgallimore

Thanks for the suggestion Jon.  We added org.quartz-scheduler as a dependency to our project and configured it in web.xml.  With that, we could get a second Scheduler started and use JobStoreTX.

However, our code schedules task using javax.ejb.Schedule annotation, e.g.:

    @Schedule(minute = "*", hour = "*")
    public void schedulerTest() {
        LOGGER.info("Entered schedulerTest");
    }

and this still uses the Scheduler started by TomEE and not the one we want.

AFAIK,  @Schedule does not have any parameter to specify which Scheduler to use.  

How can we make this to use the Scheduler we want?


> On Dec 20, 2019, at 04:23, Jonathan Gallimore <[hidden email]> wrote:
>
> TomEE uses Quartz internally to schedule EJB timers etc - the reason for
> shading it is to avoid it conflicting with Quartz packaged in your
> application. So theoretically, you should be able to package Quartz in your
> application, and use it per its own documentation. If you have a code
> sample with your issue that you can provide us with, we'd be happy to take
> a look.
>
> Cheers
>
> Jon
>
> On Fri, Dec 20, 2019 at 4:13 AM Ihsan Ecemis <[hidden email]> wrote:
>
>>
>> Hello Everyone,
>>
>> We would like to store Quartz scheduling information within a relational
>> database. We tried different configuration options to use our own
>> properties file instead of TomEE's default, but could not get it to work.
>>
>> Here are the things we tried:
>>
>> (1) We defined the system property 'org.quartz.properties', e.g. did
>> "-Dorg.quartz.properties=/tmp/quartz.properties".
>> (2) Since TomEE shades org.quartz, we also tried
>> "-Dorg.apache.openejb.quartz.properties=/tmp/quartz.properties".
>> (3) We also tried configuring this via web.xml file by adding:
>>
>>  <context-param>
>>    <param-name>quartz:config-file</param-name>
>>    <param-value>/tmp/quartz.properties</param-value>
>>  </context-param>
>>
>>
>> In all these cases, even though we set org.quartz.jobStore.class =
>> org.quartz.impl.jdbcjobstore.JobStoreTX (or
>> org.apache.openejb.quartz.jobStore.class =
>> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreTX) and adjust all
>> parameters as documented at Quartz User Guide,  TomEE is initializing
>> RAMJobStore instead of JobStoreTX.  Also, there is no indication in the
>> logs that Quartz is opening our properties file.
>>
>> How can we configure Quartz under TomEE?
>>
>> Any help would be greatly appreaciated.
>>
>> Thanks,
>>
>> Ihsan.

Reply | Threaded
Open this post in threaded view
|

Re: Configuring Quartz under TomEE

Ihsan Ecemis-2
In reply to this post by Richard Monson-Haefel

No, we did not try using a Custom Resource and it is not clear to me how to solve our problem with this.  Could you please provide some more detail?  Thank you.


> On Dec 20, 2019, at 08:23, Richard Monson-Haefel <[hidden email]> wrote:
>
> You probably tried this but I was going to suggest a Custom Resource.
> http://tomee.apache.org/application-resources.html
>
> On Thu, Dec 19, 2019 at 10:13 PM Ihsan Ecemis <[hidden email]> wrote:
>
>>
>> Hello Everyone,
>>
>> We would like to store Quartz scheduling information within a relational
>> database. We tried different configuration options to use our own
>> properties file instead of TomEE's default, but could not get it to work.
>>
>> Here are the things we tried:
>>
>> (1) We defined the system property 'org.quartz.properties', e.g. did
>> "-Dorg.quartz.properties=/tmp/quartz.properties".
>> (2) Since TomEE shades org.quartz, we also tried
>> "-Dorg.apache.openejb.quartz.properties=/tmp/quartz.properties".
>> (3) We also tried configuring this via web.xml file by adding:
>>
>>  <context-param>
>>    <param-name>quartz:config-file</param-name>
>>    <param-value>/tmp/quartz.properties</param-value>
>>  </context-param>
>>
>>
>> In all these cases, even though we set org.quartz.jobStore.class =
>> org.quartz.impl.jdbcjobstore.JobStoreTX (or
>> org.apache.openejb.quartz.jobStore.class =
>> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreTX) and adjust all
>> parameters as documented at Quartz User Guide,  TomEE is initializing
>> RAMJobStore instead of JobStoreTX.  Also, there is no indication in the
>> logs that Quartz is opening our properties file.
>>
>> How can we configure Quartz under TomEE?
>>
>> Any help would be greatly appreaciated.
>>
>> Thanks,
>>
>> Ihsan.
>
>
>
> --
> Richard Monson-Haefel
> https://twitter.com/rmonson
> https://www.linkedin.com/in/monsonhaefel/