Camel Quartz load balancing caused CamelContext name is already registered in MBeanServer

Solution Unverified - Updated -

Issue

  • We have bundle that utilizes Quartz2 and want to load balancing the scheduler by deploying the bundle onto 3 containers. The Quartz2 component is configured to use JDBCJobStore with Oracle database. This is our CamelContext setting
    <camelContext id="samDataExporterContext"  managementNamePattern="#name#-#version#" useBlueprintPropertyResolver="true" trace="false" streamCache="true"
                  xmlns="http://camel.apache.org/schema/blueprint">
        <propertyPlaceholder id="properties" location="blueprint:abc.blueprint.placeholder" />
        <package>abc.xyz.routes</package>
    </camelContext>
  • We used managementNamePattern to make sure the camel context name is the same on 3 containers so that Quartz2 will work. But by using static camel context name we occasionally ran into below error when updating the bundle profile or redeploying the profile:
ERROR | rint Extender: 1 | BlueprintCamelContext            | 134 - org.apache.camel.camel-blueprint - 2.15.1.redhat-621084 | Error occurred during starting Camel: CamelContext(context1) due CamelContext (context1) with ObjectName[org.apache.camel:context=context1-1.0.0.HA,type=context,name="context1"] is already registered. Make sure to use unique names on CamelContext when using multiple CamelContexts in the same MBeanServer.
org.apache.camel.VetoCamelContextStartException: CamelContext (context1) with ObjectName[org.apache.camel:context=context1-1.0.0.HA,type=context,name="context1"] is already registered. Make sure to use unique names on CamelContext when using multiple CamelContexts in the same MBeanServer.
    at org.apache.camel.management.DefaultManagementLifecycleStrategy.onContextStart(DefaultManagementLifecycleStrategy.java:173)
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2552)[137:org.apache.camel.camel-core:2.15.1.redhat-621084]
    at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:167)[137:org.apache.camel.camel-core:2.15.1.redhat-621084]
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2467)
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2463)
    at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2486)[137:org.apache.camel.camel-core:2.15.1.redhat-621084]
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2463)[137:org.apache.camel.camel-core:2.15.1.redhat-621084]
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
    at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2432)[137:org.apache.camel.camel-core:2.15.1.redhat-621084]
    at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:180)
    at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:212)
    at org.apache.camel.blueprint.BlueprintCamelContext.serviceChanged(BlueprintCamelContext.java:150)
  • Looks like the camel context name is not removed from MBeanServer when uninstalling the bundle.

Environment

  • Red Hat JBoss Fuse
    • 6.2.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.