Details

Type: Bug

Status:Resolved

Priority: Major

Resolution:
Won't Fix

Affects Version/s:1.2.1

Fix Version/s:
None

Component/s:
None

Labels:

None

Description

I am trying to use Spring Scheduler to automate execution of some batch jobs. However, when I add <task:annotation-driven/> to my application context I receive a NoSuchMethodException on removeInactiveExecutions. I believe this is because the task scheduler is trying to create a proxy for the jobservice. However, the execution-context.xml file in spring-batch-admin-manager META-INF/spring/batch/bootstrap/manager has a scheduled job entry that is calling removeInactiveExecutions on the job service, which is not in the interface. If I remove the <task:annotation-driven/> and define my scheduled tasks in xml the issue disappears, but excludes the ability to use annotations to schedule tasks. I think the removeInactiveExecutions method needs to be added to the JobService interface.

Activity

That method is really an implementation detail so I don't think it should be part of the interface. It would be easier just to remove the annotation from the SimpleJobService.

In the meantime, one possible approach would be to use proxy-target-class=true in the proxy generator - that isn't exposed in the task namespace (you should raise a separate SPR-* ticket for that if you want to do that), but you could get it working with bean definitions probably. Or maybe you could set up a child context and split the annotated and non-annotated scheduled tasks between the two? If you want to execute jobs with your scheduler, maybe they belong in the child context along with the jobs anyway. If that doesn't work we can look at why not.

Dave Syer
added a comment - 16/Jan/12 1:12 PM That method is really an implementation detail so I don't think it should be part of the interface. It would be easier just to remove the annotation from the SimpleJobService.
In the meantime, one possible approach would be to use proxy-target-class=true in the proxy generator - that isn't exposed in the task namespace (you should raise a separate SPR-* ticket for that if you want to do that), but you could get it working with bean definitions probably. Or maybe you could set up a child context and split the annotated and non-annotated scheduled tasks between the two? If you want to execute jobs with your scheduler, maybe they belong in the child context along with the jobs anyway. If that doesn't work we can look at why not.