gpt4 book ai didi

java - 当 JAVA_HOME 指向 JRE 1.8 时,无法使用 activemq-admin.bat 停止 JMS 代理

转载 作者:行者123 更新时间:2023-12-01 21:13:13 28 4
gpt4 key购买 nike

当 JAVA_HOME 指向 JRE (1.8.111) 时,我无法使用 activemq-admin.bat 脚本停止 JMS 代理。使用JDK时不会出现该问题。在脚本中,ACTIVEMQ_SUNJMX_START 参数被取消注释,默认端口更改为 61099,如下所示:

"set ACTIVEMQ_SUNJMX_START=-Dcom.sun.management.jmxremote.port=61099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

不知何故,该端口似乎被忽略了......

我们需要 JDK 来停止代理吗?有什么想法吗?

JRE 1.8.111
<em>PATH</em>\bin>call "..\middleware\apache-activemq-5.14.0\bin\activemq-admin.bat" "stop"
Java Runtime: Oracle Corporation 1.8.0_111 C:\Program Files\Java\jre1.8.0_111
Heap sizes: current=251392k free=248770k max=3706880k
JVM args: -Dactivemq.classpath=<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\conf;_PROGRAM_DATA_\middleware\apache-activemq-5.14.0; -Dactivemq.home=<em>PATH</em>\middleware\apache-activemq-5.14.0\bin.. -Dactivemq.base=<em>PATH</em>\middleware\apache-activemq-5.14.0\bin.. -Dactivemq.data=_PROGRAM_DATA_\middleware\apache-activemq-5.14.0 -Djava.io.tmpdir=_PROGRAM_DATA_\middleware\apache-activemq-5.14.0\tmp -Dactivemq.conf=<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\conf
Extensions classpath:
[<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib,<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib\camel,<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib\optional,<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib\web,<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib\extra]
ACTIVEMQ_HOME: <em>PATH</em>\middleware\apache-activemq-5.14.0\bin..
ACTIVEMQ_BASE: <em>PATH</em>\middleware\apache-activemq-5.14.0\bin..
ACTIVEMQ_CONF: <em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\conf
ACTIVEMQ_DATA: _PROGRAM_DATA_\middleware\apache-activemq-5.14.0
Connecting to JMX URL: service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
INFO: Broker not available at: service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi

JDK 1.8.111
<em>PATH</em>\bin>call "..\middleware\apache-activemq-5.14.0\bin\activemq-admin.bat" "stop"
Java Runtime: Oracle Corporation 1.8.0_111 C:\Program Files\Java\jdk1.8.0_111\jre
Heap sizes: current=251392k free=248770k max=3706880k
JVM args: -Dactivemq.classpath=<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\conf;_PROGRAM_DATA_\middleware\apache-activemq-5.14.0; -Dactivemq.home=<em>PATH</em>\middleware\apache-activemq-5.14.0\bin.. -Dactivemq.base=<em>PATH</em>\middleware\apache-activemq-5.14.0\bin.. -Dactivemq.data=_PROGRAM_DATA_\middleware\apache-activemq-5.14.0 -Djava.io.tmpdir=_PROGRAM_DATA_\middleware\apache-activemq-5.14.0\tmp -Dactivemq.conf=<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\conf
Extensions classpath:
[<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib,<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib\camel,<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib\optional,<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib\web,<em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\lib\extra]
ACTIVEMQ_HOME: <em>PATH</em>\middleware\apache-activemq-5.14.0\bin..
ACTIVEMQ_BASE: <em>PATH</em>\middleware\apache-activemq-5.14.0\bin..
ACTIVEMQ_CONF: <em>PATH</em>\middleware\apache-activemq-5.14.0\bin..\conf
ACTIVEMQ_DATA: _PROGRAM_DATA_\middleware\apache-activemq-5.14.0
useJmxServiceUrl Found JMS Url: service:jmx:rmi://127.0.0.1/stub/rO0ABXNyAC5qYXZheC5tYW5hZ2VtZW50LnJlbW90ZS5ybWkuUk1JU2VydmVySW1wbF9TdHViAAAAAAAAAAICAAB4cgAaamF2YS5ybWkuc2VydmVyLlJlbW90ZVN0dWLp/tzJi+FlGgIAAHhyABxqYXZhLnJtaS5zZXJ2Z
XIuUmVtb3RlT2JqZWN002G0kQxhMx4DAAB4cHc5AAtVbmljYXN0UmVmMgAADjE5Mi4xNjguMTAwLjIwAAD9nHXsmR+4orQ3llsk9wAAAVhxZdSygAIAeA==
Connecting to pid: 5020
Stopping broker: MYBROKER

最佳答案

这是因为ActiveMQ使用Java Attach API自动发现 JMX URL。要使用此 API,请从 $JAVA_HOME\..\lib\tools.jar 加载类。 。如tools.jar是 JDK 的一部分(请参阅 JDK files ),这对于 JRE(不是 JDK $JDK_HOME\jre 附带的 JRE)将会失败。

要使用 JRE 停止代理,您必须提供 JMX URL。

set ACTIVEMQ_OPTS=-Dactivemq.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:61099/jmxrmi
activemq-admin.bat stop

连接消息如下所示

Connecting to JMX URL: service:jmx:rmi:///jndi/rmi://localhost:61099/jmxrmi

关于java - 当 JAVA_HOME 指向 JRE 1.8 时,无法使用 activemq-admin.bat 停止 JMS 代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40761020/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com