本地ActiveMQ启动失败

1,之前安装完activeMQ,启动了就一直没有管,后来系统升级,当自己访问localhost:8161的时候,连接失败。找到自己activeMQ安装目录下bin-win64-activemq.bat,双击显示启动失败,查看日志,日志如下:
Exception encountered during context initialization - cancelling refresh attempt | org.apache.activemq.xbean.XBeanBrokerFactory$1 | WrapperSimpleAppMain
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.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use: JVM_Bind
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)[spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)[spring-context-3.2.11.RELEASE.jar:3.2.11.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)[spring-context-3.2.11.RELEASE.jar:3.2.11.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.12.0.jar:5.12.0]
	at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)[activemq-spring-5.12.0.jar:5.12.0]
	at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)[activemq-spring-5.12.0.jar:5.12.0]
	at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)[activemq-broker-5.12.0.jar:5.12.0]
	at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)[activemq-broker-5.12.0.jar:5.12.0]
	at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)[activemq-console-5.12.0.jar:5.12.0]
	at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:62)[activemq-console-5.12.0.jar:5.12.0]
	at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)[activemq-console-5.12.0.jar:5.12.0]
	at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:62)[activemq-console-5.12.0.jar:5.12.0]
	at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console-5.12.0.jar:5.12.0]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_73]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)[:1.8.0_73]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)[:1.8.0_73]
	at java.lang.reflect.Method.invoke(Unknown Source)[:1.8.0_73]
	at org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq.jar:5.12.0]
	at org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.12.0]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_73]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)[:1.8.0_73]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)[:1.8.0_73]
	at java.lang.reflect.Method.invoke(Unknown Source)[:1.8.0_73]
	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)[wrapper.jar:3.2.3]
	at java.lang.Thread.run(Unknown Source)[:1.8.0_73]

2,显示的是端口61613被占用,命令行输入 netstat -ano|findstr "61613",找到占用这个端口的进程的PID,在任务管理器根据PID禁用掉这个进程就可以了。

3,然后,再双击active.bat,弹出的命令行最后一行为“。。。。allowed”,就证明启动成功。

4,访问localhost:8161,访问成功。

5,我们可以双击activemq.bat下面的InstallService.bat将activeMQ加入到服务中,在此启动了,那么之后,就不用每次手动启动了。


其实,在访问失败的时候,我首先查看的是61616端口是否被占用,结果没有被占用,查看日志,才发现61613被占用了。打开conf-activemq.xml,就可以看到MQ相关的端口情况了。还有,遇到问题查看日志,可以直接找到问题根源,即使自己无法解决,把日志粘贴到网上也可以找到其他人的解决办法




你可能感兴趣的:(mq)