Joe Luo created CAMEL-5259: ------------------------------ Summary: misleading error message was thrown by camel-quartz component if camelContext ID was not unique Key: CAMEL-5259 URL: https://issues.apache.org/jira/browse/CAMEL-5259 Project: Camel Issue Type: Bug Components: camel-quartz Affects Versions: 2.8.1 Reporter: Joe Luo
Suppose we have two camel routes using camel-quartz endpoint: Route one: {code} <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> {code} Route two: {code} <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> {code} 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: {quote} 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 {quote} 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. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira