环境
- servicemix :6.1.0
- jdk:jdk1.8.0_191
- activemq:5.12.1
在同事那里copy一份servicemix之后,在使用项目去尝试连接servicemix中安装的activemq的时候,日志一只输出如下错误信息
2019-07-01 10:55:15,311 | ERROR | 84-e0b8b69b035f) | configadmin | 6 - org.apache.felix.configadmin - 1.8.4 | [org.osgi.service.cm.ManagedServiceFactory, id=813, bundle=106/mvn:org.apache.activemq/activemq-osgi/5.12.1]: Updating configuration org.apache.activemq.server.b49e3df9-e259-45c3-8384-e0b8b69b035f 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:120)[106:org.apache.activemq.activemq-osgi:5.12.1]
at Proxy92c79274_b8fc_4a41_bb78_0ec5ddad9977.updated(Unknown Source)[:]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159)[6:org.apache.felix.configadmin:1.8.4]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93)[6:org.apache.felix.configadmin:1.8.4]
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1747)[6:org.apache.felix.configadmin:1.8.4]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:103)[6:org.apache.felix.configadmin:1.8.4]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_191]
Caused by: java.lang.IllegalArgumentException: Service object is not an instance of "org.springframework.core.env.EnvironmentCapable".
at org.apache.felix.framework.Felix.registerService(Felix.java:3386)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)[org.apache.felix.framework-4.2.1.jar:]
at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.publishContextAsOsgiServiceIfNecessary(AbstractOsgiBundleApplicationContext.java:344)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:237)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)[89:org.apache.servicemix.bundles.spring-context:3.2.14.RELEASE_1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$301(AbstractDelegatedExecutionApplicationContext.java:69)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$1.run(AbstractDelegatedExecutionApplicationContext.java:186)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.normalRefresh(AbstractDelegatedExecutionApplicationContext.java:182)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$NoDependenciesWaitRefreshExecutor.refresh(AbstractDelegatedExecutionApplicationContext.java:89)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)[93:org.springframework.osgi.core:1.2.1]
at org.apache.activemq.osgi.ActiveMQServiceFactory.updated(ActiveMQServiceFactory.java:102)[106:org.apache.activemq.activemq-osgi:5.12.1]
... 6 more
2019-07-01 10:55:16,653 | ERROR | Consumer[events] | faultJmsMessageListenerContainer | 130 - org.apache.servicemix.bundles.spring-jms - 3.2.14.RELEASE_1 | Could not refresh JMS Connection for destination 'events' - retrying in 5000 ms. Cause: Error while attempting to add new Connection to the pool; nested exception is javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Broker named 'local-broker' does not exist.
解决方案:
1. 建议将servicemix中当前已安装的mq卸载重装掉,相关指令feature:uninstall 依次卸载,然候在feature:install安装(首先一个一个卸载的麻烦,其次你卸载也不一定卸的干净,在对应的data/cache目录下还是有很多缓存文件),只是理论上觉得应该可行,没有尝试过
2. 小编是个强迫症深度患者,安装的东西一定要知根知底,不想存在一些不知道什么东西的东西,所以一不做二不休,直接去官网,下载了一个新的servicemix,自己重新安装了一次,然后就解决了。。。