Skip to content

SchedulerAccessor 'globalJobListeners' and 'globalTriggerListeners' not working with 2.0.x and 2.1.x [SPR-11362] #15988

Closed

Description

@spring-projects-issues

Hatanaka, Akihiro opened SPR-11362 and commented

With Quartz 2.0, SchedulerFactoryBean throws NoSuchMethodException.

My scheduler config in appliction.xml is below.

<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="globalJobListeners">
<list>
<ref bean="qbpmContextJobListener" />
</list>
</property>
...
</bean>

There is a bug in SchedulerAccessor#registerListeners().

Quartz 2.1, 2.2 has org.quartz.core.ListenerManagerImpl.addJobListener(JobListener).
However, Quartz 2.0 does not have.

So this line throws NoSuchMethodException.

Method addJobListener = target.getClass().getMethod((quartz2 ? "addJobListener" : "addGlobalJobListener"), JobListener.class);


Affects: 3.2 GA, 3.2.6

Issue Links:

Referenced from: commits fe4b57c, c719c70

Backported to: 3.2.7

Activity

  1. spring-projects-issues commented on Jan 28, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Such Quartz API issues are a key factor why we will upgrade to Quartz 2.1+ as of Spring Framework 4.1...

    That said, for 4.0.1 and 3.2.7, we should try our best to be compatible with Quartz 2.0.x as well still.

    Juergen

  2. spring-projects-issues commented on Jan 28, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Stéphane Nicoll commented

    Actually the method was introduced with Quartz 2.2. This use case is failing with both 2.0 and 2.1. Investigating what we can do there.

  3. spring-projects-issues commented on Jan 28, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Actually, this specific case is even worse: The addListener(JobListener) method has been introduced as of Quartz 2.2. On 2.0 and 2.1, only the variant with additional Matcher arguments exists... So we'll have to reflectively detect that, specifically for Quartz 2.x, and pass in an empty List there to enforce the global matcher. There is nothing wrong with always using that method on Quartz 2.x, it seems, so at least we don't have to differentiate between Quartz 2.0, 2.1 and 2.2 there.

  4. spring-projects-issues commented on Jan 28, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Indeed :-) Seems we have to detect the addJobListener(JobListener, List) variant and pass in an empty List there... So not just use a different method name in quartz2 mode, but also use a different signature.

  5. spring-projects-issues commented on Jan 28, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Stéphane Nicoll commented

    Already done, locally :) And quartz manipulates the list behind my back so it better has to be mutable!

  6. spring-projects-issues commented on Jan 28, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Stéphane Nicoll commented

    The global trigger listeners were also affected by this issue (same root).

    Pull request available: #452

  7. spring-projects-issues commented on Jan 28, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Applied with some minor polishing, for release in 4.0.1 as well as 3.2.7.

    Juergen

  8. spring-projects-issues commented on Mar 27, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    After diving deeper into the Quartz 2.1.x line, it turns out that those addXListener variants without a matcher argument were actually introduced in Quartz 2.1.4. We'll rely on that in Spring Framework 4.1 then, since Quartz 2.1.4 will be 2.5 years old already when we go 4.1 GA.

    Juergen

  9. added
    type: bug
    status: backported
    on Jan 11, 2019
  10. added this to the 4.0.1 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

status: backportedtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions