有一个Zookeeper集群有三个节点,有一个ActiveMQ集群也有三个节点。我模拟了这样的在线环境:当我关闭zookeeper领导者节点的服务时,将会产生什么结果。所以我关闭了领导节点。并且出现问题,ActiveMQ主节点由于某种原因而关闭。所以我找到了activemq.log文件,并且有一个错误日志:
2019-08-08 16:42:30,902 | ERROR | Failed to start Apache ActiveMQ (localhost, null) | org.apache.activemq.broker.BrokerService | main
java.util.concurrent.TimeoutException: timeout reached while waiting on the lock: java.lang.Object@748fe51d
at org.linkedin.util.concurrent.ConcurrentUtils.awaitUntil(ConcurrentUtils.java:117)[org.linkedin.util-core-1.4.0.jar:]
at org.apache.activemq.leveldb.replicated.groups.ZKClient.waitForState(ZKClient.java:260)[activemq-leveldb-store-5.15.9.jar:5.15.9]
at org.apache.activemq.leveldb.replicated.groups.ZKClient.waitForConnected(ZKClient.java:248)[activemq-leveldb-store-5.15.9.jar:5.15.9]
at org.apache.activemq.leveldb.replicated.ElectingLevelDBStore.init(ElectingLevelDBStore.scala:189)[activemq-leveldb-store-5.15.9.jar:5.15.9]
at org.apache.activemq.broker.LockableServiceSupport.preStart(LockableServiceSupport.java:89)[activemq-broker-5.15.9.jar:5.15.9]
at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:54)[activemq-client-5.15.9.jar:5.15.9]
at org.apache.activemq.broker.BrokerService.doStartPersistenceAdapter(BrokerService.java:687)[activemq-broker-5.15.9.jar:5.15.9]
at org.apache.activemq.broker.BrokerService.startPersistenceAdapter(BrokerService.java:671)[activemq-broker-5.15.9.jar:5.15.9]
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:635)[activemq-broker-5.15.9.jar:5.15.9]
at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)[activemq-spring-5.15.9.jar:5.15.9]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_211]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_211]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_211]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_211]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1763)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1700)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1630)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)[spring-context-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)[spring-context-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)[xbean-spring-4.2.jar:4.2]
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)[xbean-spring-4.2.jar:4.2]
at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104)[activemq-spring-5.15.9.jar:5.15.9]
at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)[activemq-spring-5.15.9.jar:5.15.9]
at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)[activemq-spring-5.15.9.jar:5.15.9]
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)[activemq-broker-5.15.9.jar:5.15.9]
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)[activemq-broker-5.15.9.jar:5.15.9]
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)[activemq-console-5.15.9.jar:5.15.9]
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)[activemq-console-5.15.9.jar:5.15.9]
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)[activemq-console-5.15.9.jar:5.15.9]
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)[activemq-console-5.15.9.jar:5.15.9]
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console-5.15.9.jar:5.15.9]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_211]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_211]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_211]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_211]
at org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq.jar:5.15.9]
at org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.15.9]
2019-08-08 16:42:30,905 | INFO | Apache ActiveMQ 5.15.9 (localhost, null) is shutting down | org.apache.activemq.broker.BrokerService | main
2019-08-08 16:42:30,908 | INFO | Network Connector DiscoveryNetworkConnector:default-nc:BrokerService[localhost] stopped | org.apache.activemq.network.NetworkConnector | main
2019-08-08 16:42:30,910 | INFO | Connector openwire stopped | org.apache.activemq.broker.TransportConnector | main
2019-08-08 16:42:30,912 | INFO | Connector amqp stopped | org.apache.activemq.broker.TransportConnector | main
2019-08-08 16:42:30,915 | INFO | Connector stomp stopped | org.apache.activemq.broker.TransportConnector | main
2019-08-08 16:42:30,917 | INFO | Connector mqtt stopped | org.apache.activemq.broker.TransportConnector | main
2019-08-08 16:42:30,917 | INFO | Connector ws stopped | org.apache.activemq.broker.TransportConnector | main
2019-08-08 16:42:30,919 | INFO | StateChangeDispatcher terminated. | org.apache.activemq.leveldb.replicated.groups.ZKClient | ZooKeeper state change dispatcher thread
2019-08-08 16:42:31,168 | INFO | Session: 0x0 closed | org.apache.zookeeper.ZooKeeper | main
2019-08-08 16:42:31,169 | INFO | EventThread shut down | org.apache.zookeeper.ClientCnxn | main-EventThread
2019-08-08 16:42:31,170 | INFO | Apache ActiveMQ 5.15.9 (localhost, null) uptime 31.279 seconds | org.apache.activemq.broker.BrokerService | main
2019-08-08 16:42:31,174 | INFO | Apache ActiveMQ 5.15.9 (localhost, null) is shutdown | org.apache.activemq.broker.BrokerService | main
2019-08-08 16:42:31,176 | INFO | Closing org.apache.activemq.xbean.XBeanBrokerFactory$1@5aae8eb5: startup date [Thu Aug 08 16:41:59 CST 2019]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2019-08-08 16:42:31,180 | WARN | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in file [/usr/local/activemq/activemq/conf/activemq.xml]: Invocation of init method failed; nested exception is java.util.concurrent.TimeoutException: timeout reached while waiting on the lock: java.lang.Object@748fe51d | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main