根据公司的实际需要,进行公司系统架构的迁移,在迁移过程中,遇到了一个很奇葩的问题:启动ActiveMQ时报错,具体信息如下:

2015-07-27 18:00:43,922 | WARN  | Exception thrown from LifecycleProcessor on context close | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.apache.activemq.xbean.XBeanBrokerFactory$1@6276ae34: startup date [Mon Jul 27 18:00:39 EDT 2015]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.apache.activemq.hooks.SpringContextHook.run(SpringContextHook.java:30)[activemq-spring-5.10.0.jar:5.10.0]
at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:809)[activemq-broker-5.10.0.jar:5.10.0]
at org.apache.activemq.xbean.XBeanBrokerService.stop(XBeanBrokerService.java:122)[activemq-spring-5.10.0.jar:5.10.0]
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:601)[activemq-broker-5.10.0.jar:5.10.0]
at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)[activemq-spring-5.10.0.jar:5.10.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_05]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_05]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_05]
at java.lang.reflect.Method.invoke(Method.java:483)[:1.8.0_05]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1638)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1579)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:64)[xbean-spring-3.16.jar:3.16]
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:52)[xbean-spring-3.16.jar:3.16]
at org.apache.activemq.xbean.XBeanBrokerFactory$1.(XBeanBrokerFactory.java:104)[activemq-spring-5.10.0.jar:5.10.0]
at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)[activemq-spring-5.10.0.jar:5.10.0]
at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)[activemq-spring-5.10.0.jar:5.10.0]
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)[activemq-broker-5.10.0.jar:5.10.0]
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)[activemq-broker-5.10.0.jar:5.10.0]
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)[activemq-console-5.10.0.jar:5.10.0]
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)[activemq-console-5.10.0.jar:5.10.0]
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)[activemq-console-5.10.0.jar:5.10.0]
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)[activemq-console-5.10.0.jar:5.10.0]
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console-5.10.0.jar:5.10.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_05]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_05]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_05]
at java.lang.reflect.Method.invoke(Method.java:483)[:1.8.0_05]
at org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq.jar:5.10.0]
at org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.10.0]
排查问题思路:首先从log着手
说明:我的mq的安装目录为:/data/mq_server,所以log的位置在:/data/mq_server/apache-activemq-5.10.0/data目录下,直接使用tail -f activemq.log实时查看log的输出,从而判断问题
输出的日志中有“java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: ”
百度搜索了一下,找到了痴线此问题的原因:主机名(tomcat_server)中有下划线,不能识别


再次启动activemq服务:/data/mq_server/apache-activemq-5.10.0/bin//activemq start 
2015-07-27 18:09:49,273 | INFO  | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@6276ae34: startup date [Mon Jul 27 18:09:49 EDT 2015]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2015-07-27 18:09:51,121 | INFO  | PListStore:[/data/mq_server/apache-activemq-5.10.0/data/localhost/tmp_storage] started | org.apache.activemq.store.kahadb.plist.PListStoreImpl | main
2015-07-27 18:09:51,161 | INFO  | Using Persistence Adapter: KahaDBPersistenceAdapter[/data/mq_server/apache-activemq-5.10.0/data/kahadb] | org.apache.activemq.broker.BrokerService | main
2015-07-27 18:09:52,602 | INFO  | KahaDB is version 5 | org.apache.activemq.store.kahadb.MessageDatabase | main
2015-07-27 18:09:52,634 | INFO  | Recovering from the journal ... | org.apache.activemq.store.kahadb.MessageDatabase | main
2015-07-27 18:09:52,637 | INFO  | Recovery replayed 1 operations from the journal in 0.022 seconds. | org.apache.activemq.store.kahadb.MessageDatabase | main
2015-07-27 18:09:52,808 | INFO  | Apache ActiveMQ 5.10.0 (localhost, ID:tomcat-server-52376-1438034992673-0:1) is starting | org.apache.activemq.broker.BrokerService | main
2015-07-27 18:09:53,103 | INFO  | Listening for connections at: tcp://tomcat-server:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
2015-07-27 18:09:53,115 | INFO  | Connector openwire started | org.apache.activemq.broker.TransportConnector | main
2015-07-27 18:09:53,133 | INFO  | Listening for connections at: amqp://tomcat-server:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
2015-07-27 18:09:53,144 | INFO  | Connector amqp started | org.apache.activemq.broker.TransportConnector | main
2015-07-27 18:09:53,159 | INFO  | Listening for connections at: stomp://tomcat-server:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
2015-07-27 18:09:53,168 | INFO  | Connector stomp started | org.apache.activemq.broker.TransportConnector | main
2015-07-27 18:09:53,184 | INFO  | Listening for connections at: mqtt://tomcat-server:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
2015-07-27 18:09:53,193 | INFO  | Connector mqtt started | org.apache.activemq.broker.TransportConnector | main
2015-07-27 18:09:53,601 | INFO  | Listening for connections at ws://tomcat-server:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.ws.WSTransportServer | main
2015-07-27 18:09:53,603 | INFO  | Connector ws started | org.apache.activemq.broker.TransportConnector | main
2015-07-27 18:09:53,619 | INFO  | Apache ActiveMQ 5.10.0 (localhost, ID:tomcat-server-52376-1438034992673-0:1) started | org.apache.activemq.broker.BrokerService | main
2015-07-27 18:09:53,624 | INFO  | For help or more information please see: http://activemq.apache.org | org.apache.activemq.broker.BrokerService | main
2015-07-27 18:09:53,629 | WARN  | Store limit is 102400 mb (current store usage is 14 mb). The data directory: /data/mq_server/apache-activemq-5.10.0/data/kahadb only has 69426 mb of usable space - resetting to maximum available disk space: 69441 mb | org.apache.activemq.broker.BrokerService | main
2015-07-27 18:09:54,893 | INFO  | ActiveMQ WebConsole available at http://0.0.0.0:8161/ | org.apache.activemq.web.WebConsoleStarter | main
2015-07-27 18:09:55,037 | INFO  | Initializing Spring FrameworkServlet 'dispatcher' | /admin | main
2015-07-27 18:09:55,549 | INFO  | jolokia-agent: No access restrictor found at classpath:/jolokia-access.xml, access to all MBeans is allowed | /api | main

参考文章:http://bbs.csdn.net/topics/390709680