Activemq和Rabbitmq端口冲突

今天调试一个项目用到了activeMq,于是下载 apache-activemq-5.16.2 启动失败


C:\WINDOWS\system32>cd D:\apache-activemq-5.16.2\bin

C:\WINDOWS\system32>d:

D:\apache-activemq-5.16.2\bin>activemq start
Java Runtime: Oracle Corporation 1.8.0_161 C:\Program Files\Java\jdk1.8.0_161\jre
  Heap sizes: current=1005056k  free=989327k  max=1005056k
    JVM args: -Dcom.sun.management.jmxremote -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=D:\apache-activemq-5.16.2\bin\..\conf\login.config -Dactivemq.classpath=D:\apache-activemq-5.16.2\bin\..\conf;D:\apache-activemq-5.16.2\bin\../conf;D:\apache-activemq-5.16.2\bin\../conf; -Dactivemq.home=D:\apache-activemq-5.16.2\bin\.. -Dactivemq.base=D:\apache-activemq-5.16.2\bin\.. -Dactivemq.conf=D:\apache-activemq-5.16.2\bin\..\conf -Dactivemq.data=D:\apache-activemq-5.16.2\bin\..\data -Djava.io.tmpdir=D:\apache-activemq-5.16.2\bin\..\data\tmp
Extensions classpath:
  [D:\apache-activemq-5.16.2\bin\..\lib,D:\apache-activemq-5.16.2\bin\..\lib\camel,D:\apache-activemq-5.16.2\bin\..\lib\optional,D:\apache-activemq-5.16.2\bin\..\lib\web,D:\apache-activemq-5.16.2\bin\..\lib\extra]
ACTIVEMQ_HOME: D:\apache-activemq-5.16.2\bin\..
ACTIVEMQ_BASE: D:\apache-activemq-5.16.2\bin\..
ACTIVEMQ_CONF: D:\apache-activemq-5.16.2\bin\..\conf
ACTIVEMQ_DATA: D:\apache-activemq-5.16.2\bin\..\data
Loading message broker from: xbean:activemq.xml
 INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@4f970963: startup date [Sat Jun 12 20:02:50 CST 2021]; root of context hierarchy
 INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[D:\apache-activemq-5.16.2\bin\..\data\kahadb]
 INFO | KahaDB is version 7
 INFO | PListStore:[D:\apache-activemq-5.16.2\bin\..\data\localhost\tmp_storage] started
 INFO | Apache ActiveMQ 5.16.2 (localhost, ID:LAPTOP-3K7R226R-63012-1623499371742-0:1) is starting
 INFO | Listening for connections at: tcp://LAPTOP-3K7R226R:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector openwire started
ERROR | Failed to start Apache ActiveMQ (localhost, ID:LAPTOP-3K7R226R-63012-1623499371742-0:1)
java.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use: JVM_Bind
        at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:28)
        at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:2288)
        at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:2769)
        at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:2665)
        at org.apache.activemq.broker.BrokerService.doStartBroker(BrokerService.java:780)
        at org.apache.activemq.broker.BrokerService.startBroker(BrokerService.java:742)
        at org.apache.activemq.broker.BrokerService.start(BrokerService.java:645)
        at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1748)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1685)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1615)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:756)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
        at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104)
        at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)
        at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
        at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
        at org.apache.activemq.console.Main.main(Main.java:115)
Caused by: java.io.IOException: Failed to bind to server socket: amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use: JVM_Bind
        at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:34)
        at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:146)
        at org.apache.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:62)
        at org.apache.activemq.transport.TransportFactorySupport.bind(TransportFactorySupport.java:40)
        at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:335)
        at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:145)
        at org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:110)
        at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:2283)
        ... 40 more
Caused by: java.net.BindException: Address already in use: JVM_Bind
        at java.net.DualStackPlainSocketImpl.bind0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190)
        at java.net.ServerSocket.bind(ServerSocket.java:375)
        at java.net.ServerSocket.<init>(ServerSocket.java:237)
        at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
        at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:143)
        ... 46 more
 INFO | Apache ActiveMQ 5.16.2 (localhost, ID:LAPTOP-3K7R226R-63012-1623499371742-0:1) is shutting down
 INFO | Connector openwire stopped
 INFO | Connector amqp stopped
 INFO | Connector stomp stopped
 INFO | Connector mqtt stopped
 INFO | Connector ws stopped
 INFO | PListStore:[D:\apache-activemq-5.16.2\bin\..\data\localhost\tmp_storage] stopped
 INFO | Stopping async queue tasks
 INFO | Stopping async topic tasks
 INFO | Stopped KahaDB
 INFO | Apache ActiveMQ 5.16.2 (localhost, ID:LAPTOP-3K7R226R-63012-1623499371742-0:1) uptime 0.847 seconds
 INFO | Apache ActiveMQ 5.16.2 (localhost, ID:LAPTOP-3K7R226R-63012-1623499371742-0:1) is shutdown
 INFO | Closing org.apache.activemq.xbean.XBeanBrokerFactory$1@4f970963: startup date [Sat Jun 12 20:02:50 CST 2021]; root of context hierarchy
 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.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use: JVM_Bind
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
java.lang.RuntimeException: Failed to execute start task. Reason: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
        at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:91)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
        at org.apache.activemq.console.Main.main(Main.java:115)
Caused by: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
        at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:164)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1034)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555)
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
        at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104)
        at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)
        at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
        at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)
        ... 10 more
ERROR: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
        at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:164)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1034)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555)
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
        at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104)
        at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)
        at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
        at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
        at org.apache.activemq.console.Main.main(Main.java:115)
D:\apache-activemq-5.16.2\bin>

端口5672被占用了!

使用cmd命令行查到被erl.exe占用了,想到这不是RabbitMQ的服务嘛

D:\apache-activemq-5.16.2\bin>netstat -aon | findstr "5672"
  TCP    0.0.0.0:5672           0.0.0.0:0              LISTENING       6000
  TCP    0.0.0.0:15672          0.0.0.0:0              LISTENING       6000
  TCP    0.0.0.0:25672          0.0.0.0:0              LISTENING       6000
  TCP    127.0.0.1:15672        127.0.0.1:63042        TIME_WAIT       0
  TCP    127.0.0.1:15672        127.0.0.1:63206        ESTABLISHED     6000
  TCP    127.0.0.1:63206        127.0.0.1:15672        ESTABLISHED     17192
  TCP    [::]:5672              [::]:0                 LISTENING       6000

D:\apache-activemq-5.16.2\bin>

 其中的一个项目是使用的RabbitMQ消息队列,所以命令行一直起着,但总不能为了一个ActiveMQ就不能用RabbitMQ吧,在网上搜索了一番,发现ActiveMQ的5672端口号是可以改动的。

 

解决方案:

修改D:\apache-activemq-5.16.2\conf\activemq.xml文件,搜索端口号5672,将其改为5673,保存后重新启动activemq即可!


D:\apache-activemq-5.16.2\bin>activemq start
Java Runtime: Oracle Corporation 1.8.0_161 C:\Program Files\Java\jdk1.8.0_161\jre
  Heap sizes: current=1005056k  free=989327k  max=1005056k
    JVM args: -Dcom.sun.management.jmxremote -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=D:\apache-activemq-5.16.2\bin\..\conf\login.config -Dactivemq.classpath=D:\apache-activemq-5.16.2\bin\..\conf;D:\apache-activemq-5.16.2\bin\../conf;D:\apache-activemq-5.16.2\bin\../conf; -Dactivemq.home=D:\apache-activemq-5.16.2\bin\.. -Dactivemq.base=D:\apache-activemq-5.16.2\bin\.. -Dactivemq.conf=D:\apache-activemq-5.16.2\bin\..\conf -Dactivemq.data=D:\apache-activemq-5.16.2\bin\..\data -Djava.io.tmpdir=D:\apache-activemq-5.16.2\bin\..\data\tmp
Extensions classpath:
  [D:\apache-activemq-5.16.2\bin\..\lib,D:\apache-activemq-5.16.2\bin\..\lib\camel,D:\apache-activemq-5.16.2\bin\..\lib\optional,D:\apache-activemq-5.16.2\bin\..\lib\web,D:\apache-activemq-5.16.2\bin\..\lib\extra]
ACTIVEMQ_HOME: D:\apache-activemq-5.16.2\bin\..
ACTIVEMQ_BASE: D:\apache-activemq-5.16.2\bin\..
ACTIVEMQ_CONF: D:\apache-activemq-5.16.2\bin\..\conf
ACTIVEMQ_DATA: D:\apache-activemq-5.16.2\bin\..\data
Loading message broker from: xbean:activemq.xml
 INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@4f970963: startup date [Sat Jun 12 20:11:15 CST 2021]; root of context hierarchy
 INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[D:\apache-activemq-5.16.2\bin\..\data\kahadb]
 INFO | KahaDB is version 7
 INFO | PListStore:[D:\apache-activemq-5.16.2\bin\..\data\localhost\tmp_storage] started
 INFO | Apache ActiveMQ 5.16.2 (localhost, ID:LAPTOP-3K7R226R-63494-1623499876924-0:1) is starting
 INFO | Listening for connections at: tcp://LAPTOP-3K7R226R:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector openwire started
 INFO | Listening for connections at: amqp://LAPTOP-3K7R226R:5673?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector amqp started
 INFO | Listening for connections at: stomp://LAPTOP-3K7R226R:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector stomp started
 INFO | Listening for connections at: mqtt://LAPTOP-3K7R226R:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector mqtt started
 INFO | Starting Jetty server
 INFO | Creating Jetty connector
 WARN | ServletContext@o.e.j.s.ServletContextHandler@6995bf68{/,null,STARTING} has uncovered http methods for path: /
 INFO | Listening for connections at ws://LAPTOP-3K7R226R:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector ws started
 INFO | Apache ActiveMQ 5.16.2 (localhost, ID:LAPTOP-3K7R226R-63494-1623499876924-0:1) started
 INFO | For help or more information please see: http://activemq.apache.org
 INFO | ActiveMQ WebConsole available at http://127.0.0.1:8161/
 INFO | ActiveMQ Jolokia REST API available at http://127.0.0.1:8161/api/jolokia/

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值