[
https://issues.apache.org/jira/browse/CAMEL-12063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16291038#comment-16291038
]
Claus Ibsen commented on CAMEL-12063:
-------------------------------------
Can you provide a sample project.
Also next time ask on the user mailing list first for help, as using JIRA first
is not the correct way.
The reload directory option you use is only for reloading Camel routes. So you
must be doing something different that causes the entire CamelContext to be
reloaded, maybe by spring or something.
> Spring Boot - xmlRoutesReloadDirectory & jmxCreateConnector issue -
> duplicated JMX
> ----------------------------------------------------------------------------------
>
> Key: CAMEL-12063
> URL: https://issues.apache.org/jira/browse/CAMEL-12063
> Project: Camel
> Issue Type: Bug
> Components: camel-spring-boot
> Environment: Windows
> Camel 2.20.0
> JDK 1.8
> Reporter: Frédéric OLIER
> Priority: Minor
>
> We configured CAMEL with Spring Boot.
> We used the 'application.properties' file to set-up a folder in which routes
> are read from when they are updated:
> camel.springboot.xmlRoutesReloadDirectory=/path/to/route/folder/
> *First remark:* If a file is already in the folder, a 'touch' on it is
> required for it to be loaded.
> We then tried to configure an JMX agent with the following configuration,
> still in 'application.properties':
> camel.sprintboot.jmxCreateConnector=true
> *Second remark:* The value is not set. We traced (debug mode) to check
> whether the method 'CamelConfigurationProperties.setJmxCreateConnector()' was
> called. It is NOT called.
> We therefore configured our Spring Boot application to load a context on
> start-up:
> {{
> @SpringBootApplication
> @ImportResource({"classpath:camelContext.xml"})
> public class ST3Application {
> /**
> * A main method to start this application.
> * @throws Exception
> */
> public static void main(String[] args) throws Exception {
> SpringApplication.run(ST3Application.class, args);
> }
> }
> }}
> The camelContext.xml being as follows:
> {{
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
> <camelContext id="camel-xml"
> xmlns="http://camel.apache.org/schema/spring">
> <jmxAgent id="agent" createConnector="true" />
> </camelContext>
> </beans>
> }}
> In this case, the JMX Bean is exposed and accessible via a JMX client.
> *Third remark:* When we update the route file from the
> '/path/to/route/folder/' folder, there is a message in the log indicateing
> that there is a conflict with the exposed JMX:
> {{
> 2017-12-05 09:49:37.368 WARN 3096 --- [ main]
> a.c.m.DefaultManagementLifecycleStrategy : This CamelContext(camel-xml) will
> be registered using the name: camel-xml-1 due to clash with an existing name
> already registered in MBeanServer.
> }}
> So it seems that upon routes reloading, the initial JMX are not properly
> destroyed before creating the new ones.
> The annoying thing is that we cannot safely access the MBean as it is mixed
> up.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)