Linux部署Apache ActiveMQ 5.14.2启动报错

在linux下安装好ActiveMQ后,执行 ./activemq start 启动 ActiveMQ,显示:

INFO: Loading '/home/sso/activemq-5.14.2//bin/env'
INFO: Using java '/home/sso/jdk1.8.0_25/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/home/sso/activemq-5.14.2//data/activemq.pid' (pid '12315')

从提示信息看,似乎启动成功,但根据提示信息中的 pid 查找进程时,却发现并无此进程:

netstat -an|grep 61616  或者 ps -eLf | grep 12315

问题原因:

查看activemq日志:
cat /home/sso/activemq-5.14.2/data/activemq.log 结果如下:

2016-12-15 12:54:09,042 | INFO  | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@62ccf439: startup date [Thu Dec 15 12:54:09 CST 2016]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | WrapperSimpleAppMain
2016-12-15 12:54:11,096 | INFO  | Using Persistence Adapter: KahaDBPersistenceAdapter[/home/sso/activemq-5.14.1/bin/linux-x86-64/../../data/kahadb] | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
2016-12-15 12:54:11,166 | INFO  | KahaDB is version 6 | org.apache.activemq.store.kahadb.MessageDatabase | WrapperSimpleAppMain
2016-12-15 12:54:11,211 | INFO  | PListStore:[/home/sso/activemq-5.14.1/bin/linux-x86-64/../../data/localhost/tmp_storage] started | org.apache.activemq.store.kahadb.plist.PListStoreImpl | WrapperSimpleAppMain
2016-12-15 12:54:11,387 | INFO  | Apache ActiveMQ 5.14.1 (localhost, ID:linux_5f121-36152-1481777651238-0:1) is starting | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
2016-12-15 12:54:11,425 | INFO  | Listening for connections at: tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | WrapperSimpleAppMain
2016-12-15 12:54:11,435 | INFO  | Connector openwire started | org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2016-12-15 12:54:11,447 | INFO  | Listening for connections at: amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | WrapperSimpleAppMain
2016-12-15 12:54:11,456 | INFO  | Connector amqp started | org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2016-12-15 12:54:11,469 | INFO  | Listening for connections at: stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | WrapperSimpleAppMain
2016-12-15 12:54:11,477 | INFO  | Connector stomp started | org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2016-12-15 12:54:11,490 | INFO  | Listening for connections at: mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | WrapperSimpleAppMain
2016-12-15 12:54:11,547 | INFO  | Connector mqtt started | org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2016-12-15 12:54:11,640 | ERROR | Failed to start Apache ActiveMQ ([localhost, ID:linux_5f121-36152-1481777651238-0:1], java.net.URISyntaxException: Illegal character in hostname at index 10: ws://linux_5f121:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600) | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
2016-12-15 12:54:11,647 | INFO  | Apache ActiveMQ 5.14.1 (localhost, ID:linux_5f121-36152-1481777651238-0:1) is shutting down | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
2016-12-15 12:54:11,652 | INFO  | Connector openwire stopped | org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2016-12-15 12:54:11,656 | INFO  | Connector amqp stopped | org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2016-12-15 12:54:11,661 | INFO  | Connector stomp stopped | org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2016-12-15 12:54:11,661 | INFO  | socketQueue interrupted - stopping | org.apache.activemq.transport.tcp.TcpTransportServer | ActiveMQ Transport Server Thread Handler: stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600
2016-12-15 12:54:11,663 | INFO  | Connector mqtt stopped | org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2016-12-15 12:54:11,666 | INFO  | Could not accept connection during shutdown  : java.lang.InterruptedException | org.apache.activemq.broker.TransportConnector | ActiveMQ Transport Server Thread Handler: stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600
2016-12-15 12:54:11,668 | INFO  | Connector ws stopped | org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2016-12-15 12:54:11,676 | INFO  | PListStore:[/home/sso/activemq-5.14.1/bin/linux-x86-64/../../data/localhost/tmp_storage] stopped | org.apache.activemq.store.kahadb.plist.PListStoreImpl | WrapperSimpleAppMain
2016-12-15 12:54:11,677 | INFO  | Stopping async queue tasks | org.apache.activemq.store.kahadb.KahaDBStore | WrapperSimpleAppMain
2016-12-15 12:54:11,678 | INFO  | Stopping async topic tasks | org.apache.activemq.store.kahadb.KahaDBStore | WrapperSimpleAppMain
2016-12-15 12:54:11,681 | INFO  | Stopped KahaDB | org.apache.activemq.store.kahadb.KahaDBStore | WrapperSimpleAppMain
2016-12-15 12:54:11,706 | INFO  | Apache ActiveMQ 5.14.1 (localhost, ID:linux_5f121-36152-1481777651238-0:1) uptime 0.655 seconds | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
2016-12-15 12:54:11,708 | INFO  | Apache ActiveMQ 5.14.1 (localhost, ID:linux_5f121-36152-1481777651238-0:1) is shutdown | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
2016-12-15 12:54:11,710 | INFO  | Closing org.apache.activemq.xbean.XBeanBrokerFactory$1@62ccf439: startup date [Thu Dec 15 12:54:09 CST 2016]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | WrapperSimpleAppMain
2016-12-15 12:54:11,715 | WARN  | Exception thrown from LifecycleProcessor on context close | org.apache.activemq.xbean.XBeanBrokerFactory$1 | WrapperSimpleAppMain
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.apache.activemq.xbean.XBeanBrokerFactory$1@62ccf439: startup date [Thu Dec 15 12:54:09 CST 2016]; root of context hierarchy
        at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:357)[spring-context-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:884)[spring-context-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:843)[spring-context-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.apache.activemq.hooks.SpringContextHook.run(SpringContextHook.java:30)[activemq-spring-5.14.1.jar:5.14.1]
        at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:875)[activemq-broker-5.14.1.jar:5.14.1]
        at org.apache.activemq.xbean.XBeanBrokerService.stop(XBeanBrokerService.java:122)[activemq-spring-5.14.1.jar:5.14.1]
        at org.apache.activemq.broker.BrokerService.start(BrokerService.java:629)[activemq-broker-5.14.1.jar:5.14.1]
        at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)[activemq-spring-5.14.1.jar:5.14.1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_79]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_79]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79]
        at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1700)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1639)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)[spring-context-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)[spring-context-4.1.9.RELEASE.jar:4.1.9.RELEASE]
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:64)[xbean-spring-3.18.jar:3.18]
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:52)[xbean-spring-3.18.jar:3.18]
        at org.apache.activemq.xbean.XBeanBrokerFactory$1.(XBeanBrokerFactory.java:104)[activemq-spring-5.14.1.jar:5.14.1]
        at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)[activemq-spring-5.14.1.jar:5.14.1]
        at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)[activemq-spring-5.14.1.jar:5.14.1]
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)[activemq-broker-5.14.1.jar:5.14.1]
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)[activemq-broker-5.14.1.jar:5.14.1]
        at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)[activemq-console-5.14.1.jar:5.14.1]
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)[activemq-console-5.14.1.jar:5.14.1]
        at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)[activemq-console-5.14.1.jar:5.14.1]
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)[activemq-console-5.14.1.jar:5.14.1]
        at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console-5.14.1.jar:5.14.1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_79]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_79]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79]
        at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79]
        at org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq.jar:5.14.1]
        at org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.14.1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_79]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_79]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79]
        at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79]
        at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)[wrapper.jar:3.2.3]
        at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]
2016-12-15 12:54:11,726 | 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 class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.net.URISyntaxException: Illegal character in hostname at index 10: ws://linux_5f121:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.xbean.XBeanBrokerFactory$1 | WrapperSimpleAppMain
百度了很久,问题并没有解决,其实问题在上面第一个 ERROR 处,即

2016-12-15 12:54:11,640 | ERROR | Failed to start Apache ActiveMQ ([localhost, ID:linux_5f121-36152-1481777651238-0:1], java.net.URISyntaxException: Illegal character in hostname at index 10: ws://linux_5f121:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600) | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
从提示的信息 Illegal character in hostname at index 10可以看出主机名有特殊字符。

解决方案1(网上百度出的方案):

1.修改/etc/sysconfig/network 
修改 hostname=xxx, 不能有下划线
2.修改/etc/hosts 
添加刚刚 修改hostname的名字. 
3.reboot 重启
4.重新启动active 

注:由于主机是公司公共主机,并且部署了很多其他重要应用,所以此方案未采纳,未验证。

解决方案2:

将 conf/activemq.xml 文件中 transportConnectors/transportConnector uri 属性中的 0.0.0.0 替换成你主机的域名,或者127.0.0.1 


            
            
            
            
            
            
        
经过验证替换成127.0.0.1时启动activemq时还是会替换成主机名启动失败,直接替换成主机ip即启动成功。


你可能感兴趣的:(activemq)