Search code examples
activemq-classicapache-servicemix

amq-broker failed to start in ServiceMix


When starting ServiceMix, I'm getting this error on startup.

2017-06-21 16:24:51,647 | ERROR | ctivemq.server]) | configadmin                      | 3 - org.apache.felix.configadmin - 1.8.12 | [org.osgi.service.cm.ManagedServiceFactory, id=188, bundle=25/mvn:org.apache.activemq/activemq-osgi/5.14.3]: Updating configuration org.apache.activemq.server.598341f8-41a8-446f-b9f2-0de589a8a14c caused a problem: Cannot start the broker
org.osgi.service.cm.ConfigurationException: null : Cannot start the broker
        at org.apache.activemq.osgi.ActiveMQServiceFactory.updated(ActiveMQServiceFactory.java:144)[25:org.apache.activemq.activemq-osgi:5.14.3]
        at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.provide(ConfigurationManager.java:1620)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1563)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)[3:org.apache.felix.configadmin:1.8.12]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
Caused by: javax.management.InstanceAlreadyExistsException: org.apache.activemq:type=Broker,brokerName=amq-broker
        at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)[:1.8.0_121]
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)[:1.8.0_121]
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)[:1.8.0_121]
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)[:1.8.0_121]
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)[:1.8.0_121]
        at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)[:1.8.0_121]
        at org.apache.activemq.broker.jmx.ManagementContext.registerMBean(ManagementContext.java:408)[25:org.apache.activemq.activemq-osgi:5.14.3]
        at org.apache.activemq.broker.jmx.AnnotatedMBean.registerMBean(AnnotatedMBean.java:72)[25:org.apache.activemq.activemq-osgi:5.14.3]
        at org.apache.activemq.broker.BrokerService.startManagementContext(BrokerService.java:2584)[25:org.apache.activemq.activemq-osgi:5.14.3]
        at org.apache.activemq.broker.BrokerService.start(BrokerService.java:608)[25:org.apache.activemq.activemq-osgi:5.14.3]
        at org.apache.activemq.osgi.ActiveMQServiceFactory.updated(ActiveMQServiceFactory.java:140)[25:org.apache.activemq.activemq-osgi:5.14.3]

nothing has been deployed to it, and the only changes so far is that camel-http4, camel-jetty9, and camel-mongodb features have been installed.

What could be causing this and how can I fix it?


Solution

  • I've figured out the cause. ServiceMix was started, had the features installed, stopped, zipped, sent to a new machine, and unpacked in a different directory.

    The problem was fixed by deleting the following folder

    apache-servicemix-7.0.0\data\cache\bundle3\data\config\org\apache\activemq\server
    

    Which contained ActiveMQ config information that was no longer valid after the server was moved.

    Other systems appeared to also be affected by this. The proper way to fix it seems to be to either delete the data directory while karaf is offline, or to start karaf with the clean flag. (Note, this will wipe all changes from the base version though)

    I have since moved on to using the karaf-maven-plugin for pre-setting up the server, and only installing the servicemix components I'm actually using.