启动activemq时端口绑定异常

问题描述 投票:0回答:2

我正在尝试使用命令启动 activeMq

activemq.bat start

但是使用此命令会停止活动 MQ;看起来原因是端口不可用。这是错误片段:

 INFO | Apache ActiveMQ 5.10.0 (localhost, ID:LT7634-51673-1426517344431-0:1) is starting
ERROR | Failed to start Apache ActiveMQ ([localhost, ID:LT7634-51673-1426517344431-0:1], java.io.IOException: Transport Connector could not
be registered in JMX: Failed to bind to server socket: tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to:
 java.net.BindException: Address already in use: JVM_Bind)
 INFO | Apache ActiveMQ 5.10.0 (localhost, ID:LT7634-51673-1426517344431-0:1) is shutting down

但是;我已经验证端口 61616 实际上没有被任何其他程序使用。我通过在命令提示符中执行以下操作来完成此操作:

netstat -aon | findstr "61616"

我无法找出可能导致此问题的原因。 有没有其他方法可以找到可能导致此问题的问题?我还检查了 activemq.log;这几乎显示了与控制台中相同的日志。

我尝试过但不起作用的事情: 1.尝试重启系统。

  1. 尝试使用 netsta -aon 命令查找具有 activemq、amq 或 apache 的进程。什么也没找到。

  2. 尝试删除 %ACTIVEMQ_HOME%\data 文件夹下的 kahadb 文件夹。该文件夹将被重新创建。

添加完整的控制台输出

D:\DevProgs\Dumps\Apache\Activemq-5.10.0\bin>activemq.bat start
Java Runtime: Oracle Corporation 1.7.0_60 D:\DevProgs\Installed\JAVA\JDKs\jdk1.7.0_60\jre
  Heap sizes: current=1005568k  free=989808k  max=1005568k
    JVM args: -Dcom.sun.management.jmxremote -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.con
fig=D:\DevProgs\Dumps\Apache\Activemq-5.10.0\conf\login.config -Dactivemq.classpath=D:\DevProgs\Dumps\Apache\Activemq-5.10.0\conf;D:\DevProg
s\Dumps\Apache\Activemq-5.10.0/conf;D:\DevProgs\Dumps\Apache\Activemq-5.10.0/conf; -Dactivemq.home=D:\DevProgs\Dumps\Apache\Activemq-5.10.0
-Dactivemq.base=D:\DevProgs\Dumps\Apache\Activemq-5.10.0 -Dactivemq.conf=D:\DevProgs\Dumps\Apache\Activemq-5.10.0\conf -Dactivemq.data=D:\De
vProgs\Dumps\Apache\Activemq-5.10.0\data -Djava.io.tmpdir=D:\DevProgs\Dumps\Apache\Activemq-5.10.0\data\tmp
Extensions classpath:
  [D:\DevProgs\Dumps\Apache\Activemq-5.10.0\lib,D:\DevProgs\Dumps\Apache\Activemq-5.10.0\lib\camel,D:\DevProgs\Dumps\Apache\Activemq-5.10.0\
lib\optional,D:\DevProgs\Dumps\Apache\Activemq-5.10.0\lib\web,D:\DevProgs\Dumps\Apache\Activemq-5.10.0\lib\extra]
ACTIVEMQ_HOME: D:\DevProgs\Dumps\Apache\Activemq-5.10.0
ACTIVEMQ_BASE: D:\DevProgs\Dumps\Apache\Activemq-5.10.0
ACTIVEMQ_CONF: D:\DevProgs\Dumps\Apache\Activemq-5.10.0\conf
ACTIVEMQ_DATA: D:\DevProgs\Dumps\Apache\Activemq-5.10.0\data
Loading message broker from: xbean:activemq.xml
 INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@fa0a4ca: startup date [Mon Mar 16 21:43:44 IST 2015]; root of context hier
archy
 INFO | PListStore:[D:\DevProgs\Dumps\Apache\Activemq-5.10.0\data\localhost\tmp_storage] started
 INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[D:\DevProgs\Dumps\Apache\Activemq-5.10.0\data\kahadb]
 INFO | JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
 INFO | KahaDB is version 5
 INFO | Recovering from the journal ...
 INFO | Recovery replayed 1 operations from the journal in 0.016 seconds.
 INFO | Apache ActiveMQ 5.10.0 (localhost, ID:LT7634-52369-1426522426222-0:1) is starting
ERROR | Failed to start Apache ActiveMQ ([localhost, ID:LT7634-52369-1426522426222-0:1], java.io.IOException: Transport Connector could not
be registered in JMX: Failed to bind to server socket: tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to:
 java.net.BindException: Address already in use: JVM_Bind)
 INFO | Apache ActiveMQ 5.10.0 (localhost, ID:LT7634-52369-1426522426222-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:\DevProgs\Dumps\Apache\Activemq-5.10.0\data\localhost\tmp_storage] stopped
 INFO | Stopping async queue tasks
 INFO | Stopping async topic tasks
 INFO | Stopped KahaDB
 INFO | Apache ActiveMQ 5.10.0 (localhost, ID:LT7634-52369-1426522426222-0:1) uptime 0.969 seconds
 INFO | Apache ActiveMQ 5.10.0 (localhost, ID:LT7634-52369-1426522426222-0:1) is shutdown
 INFO | Closing org.apache.activemq.xbean.XBeanBrokerFactory$1@fa0a4ca: startup date [Mon Mar 16 21:43:44 IST 2015]; root of context hierarc
hy
 WARN | Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.
apache.activemq.xbean.XBeanBrokerFactory$1@fa0a4ca: startup date [Mon Mar 16 21:43:44 IST 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.R
ELEASE.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.7.0_60]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_60]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_60]
        at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_60]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFa
ctory.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.ja
va: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:4
58)[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.RELEAS
E.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.ja
r: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:93
2)[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.<init>(ResourceXmlApplicationContext.java:64)[xbean-spring-3.16.jar
:3.16]
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)[xbean-spring-3.16.jar
:3.16]
        at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(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.1
0.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.7.0_60]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_60]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_60]
        at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_60]
        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]
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: java.lang.IllegalStateException: BeanFactory not initialized or alr
eady 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 cl
osed - 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:57)
        at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        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 Ap
plicationContext
        at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.ja
va:171)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1090)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:487)
        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 Applic
ationContext
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationCo
ntext
        at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.ja
va:171)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1090)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:487)
        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:57)
        at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
        at org.apache.activemq.console.Main.main(Main.java:115)
D:\DevProgs\Dumps\Apache\Activemq-5.10.0\bin>
jvm activemq
2个回答
2
投票

在安装目录的conf/activemq.xml中。将所有

transportConnectors
标签 uri 值从
0.0.0.0
更改为
127.0.0.1
对我有用 [macOS sierra 10.12]。 似乎activemq无法在macos中绑定到0.0.0.0。不确定是否可以在 win7 上运行。

<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
...

<transportConnector name="openwire" uri="tcp://127.0.0.1:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
...

和控制台:

jvm 1    | Loading message broker from: xbean:activemq.xml
jvm 1    |  INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@37e52688: startup date [Tue May 16 15:24:47 CST 2017]; root of context hierarchy
jvm 1    |  INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[/Users/se_ven/seven/apache-activemq/apache-activemq-5.14.5/bin/macosx/../../data/kahadb]
jvm 1    |  INFO | KahaDB is version 6
jvm 1    |  INFO | PListStore:[/Users/se_ven/seven/apache-activemq/apache-activemq-5.14.5/bin/macosx/../../data/localhost/tmp_storage] started
jvm 1    |  INFO | Apache ActiveMQ 5.14.5 (localhost, ID:se_ven.code-52987-1494919488296-0:1) is starting
jvm 1    |  INFO | Listening for connections at: tcp://localhost:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1    |  INFO | Connector openwire started
jvm 1    |  INFO | Listening for connections at: amqp://localhost:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1    |  INFO | Connector amqp started
jvm 1    |  INFO | Listening for connections at: stomp://localhost:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1    |  INFO | Connector stomp started
jvm 1    |  INFO | Listening for connections at: mqtt://localhost:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1    |  INFO | Connector mqtt started
jvm 1    |  WARN | [email protected]@1088a016{/,null,STARTING} has uncovered http methods for path: /
jvm 1    |  INFO | Listening for connections at ws://localhost:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1    |  INFO | Connector ws started
jvm 1    |  INFO | Apache ActiveMQ 5.14.5 (localhost, ID:se_ven.code-52987-1494919488296-0:1) started
jvm 1    |  INFO | For help or more information please see: http://activemq.apache.org
jvm 1    |  INFO | No Spring WebApplicationInitializer types detected on classpath
jvm 1    |  INFO | ActiveMQ WebConsole available at http://0.0.0.0:8161/
jvm 1    |  INFO | ActiveMQ Jolokia REST API available at http://0.0.0.0:8161/api/jolokia/
jvm 1    |  INFO | Initializing Spring FrameworkServlet 'dispatcher'
jvm 1    |  INFO | No Spring WebApplicationInitializer types detected on classpath
jvm 1    |  INFO | jolokia-agent: Using policy access restrictor classpath:/jolokia-access.xml

0
投票

@Seven 的上述解决方案对我不起作用。因为这是我的开发机器,所以我刚刚禁用了 < transportConnectors >,现在它可以工作了。

<transportConnectors>
            <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
            <!--transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/-->
</transportConnectors>

请注意:请勿在生产中尝试此操作

© www.soinside.com 2019 - 2024. All rights reserved.