Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.8.1
-
None
-
Unknown
Description
Suppose we have two camel routes using camel-quartz endpoint:
Route one:
<camelContext id="camel-quartz-context"> <route id="RouteOne"> <from uri="quartz://testTimer/TimerOne?cron=0+0/1+*+*+*+?" /> <to uri="log:CamelQuartzRouteOne - Route One fired?level=INFO" /> </route> </camelContext>
Route two:
<camelContext id="camel-quartz-context"> <route id="RouteTwo"> <from uri="quartz://testTimer/TimerTwo?cron=0+0/1+*+*+*+?" /> <to uri="log:CamelQuartzRouteTwo - Route Two fired?level=INFO" /> </route> </camelContext>
Accidentally, both routes were configured using the same camelContext ID of "camel-quartz-context". After deploying the two camel routes, say, into ServiceMix container, following message will be thrown:
14:50:00,004 | ERROR | context_Worker-1 | JobRunShell | 195 - org.apache.servicemix.bundles.quartz - 1.8.5.1 | Job DEFAULT.quartz-endpoint9 threw an unhandled Exception:
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: quartz://testTimer/TimerOne?cron=0+0%2F1+*+%3F due to: A Quartz job already exists with the name/group: TimerOne/testTimer
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:444)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:457)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
at org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:50)[215:org.apache.camel.camel-quartz:2.8.0.fuse-02-05]
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)[195:org.apache.servicemix.bundles.quartz:1.8.5.1]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[195:org.apache.servicemix.bundles.quartz:1.8.5.1]
Caused by: java.lang.IllegalArgumentException: A Quartz job already exists with the name/group: TimerOne/testTimer
at org.apache.camel.component.quartz.QuartzComponent.createEndpoint(QuartzComponent.java:130)[215:org.apache.camel.camel-quartz:2.8.0.fuse-02-05]
at org.apache.camel.component.quartz.QuartzComponent.createEndpoint(QuartzComponent.java:56)[215:org.apache.camel.camel-quartz:2.8.0.fuse-02-05]
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:426)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
... 4 more
despite two camel-quartz endpoints were using different job names.
The root cause was duplicate camelContext ID used by two camel routes as it has to be unique. However, the error message was certainly misleading.