当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
PATH\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=PATH\middleware\apache-activemq-5.14.0\bin..\conf;_PROGRAM_DATA_\middleware\apache-activemq-5.14.0; -Dactivemq.home=PATH\middleware\apache-activemq-5.14.0\bin.. -Dactivemq.base=PATH\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=PATH\middleware\apache-activemq-5.14.0\bin..\conf
Extensions classpath:
[PATH\middleware\apache-activemq-5.14.0\bin..\lib,PATH\middleware\apache-activemq-5.14.0\bin..\lib\camel,PATH\middleware\apache-activemq-5.14.0\bin..\lib\optional,PATH\middleware\apache-activemq-5.14.0\bin..\lib\web,PATH\middleware\apache-activemq-5.14.0\bin..\lib\extra]
ACTIVEMQ_HOME: PATH\middleware\apache-activemq-5.14.0\bin..
ACTIVEMQ_BASE: PATH\middleware\apache-activemq-5.14.0\bin..
ACTIVEMQ_CONF: PATH\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
PATH\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=PATH\middleware\apache-activemq-5.14.0\bin..\conf;_PROGRAM_DATA_\middleware\apache-activemq-5.14.0; -Dactivemq.home=PATH\middleware\apache-activemq-5.14.0\bin.. -Dactivemq.base=PATH\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=PATH\middleware\apache-activemq-5.14.0\bin..\conf
Extensions classpath:
[PATH\middleware\apache-activemq-5.14.0\bin..\lib,PATH\middleware\apache-activemq-5.14.0\bin..\lib\camel,PATH\middleware\apache-activemq-5.14.0\bin..\lib\optional,PATH\middleware\apache-activemq-5.14.0\bin..\lib\web,PATH\middleware\apache-activemq-5.14.0\bin..\lib\extra]
ACTIVEMQ_HOME: PATH\middleware\apache-activemq-5.14.0\bin..
ACTIVEMQ_BASE: PATH\middleware\apache-activemq-5.14.0\bin..
ACTIVEMQ_CONF: PATH\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
答案 0 :(得分:3)
这是因为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