这是我在阅读与试验过程中所遇到的几个问题。希望对你有所帮助。
1. 运行activemq:list指令时发生错误。
karaf@root> activemq:list
Connecting to JMX URL: service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
ERROR: java.lang.RuntimeException: Failed to execute list task. Reason: java.io.IOException: Failed to retrieve RMIServer stu
b: javax.naming.NameNotFoundException: jmxrmi
java.lang.RuntimeException: Failed to execute list task. Reason: java.io.IOException: Failed to retrieve RMIServer stub: java
x.naming.NameNotFoundException: jmxrmi
at org.apache.activemq.console.command.ListCommand.runTask(ListCommand.java:53)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at org.apache.activemq.console.command.AbstractJmxCommand.execute(AbstractJmxCommand.java:316)
at org.apache.activemq.karaf.commands.ActiveMQCommandSupport.doExecute(ActiveMQCommandSupport.java:46)
at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)
at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
at org.apache.karaf.shell.console.jline.Console.run(Console.java:218)
at java.lang.Thread.run(Thread.java:662)
Error executing command: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: jmxrmi
修改<SERVICEMIX_HOME>/etc/activemq-broker.xml文件中:
<!-- Use the following to configure how ActiveMQ is exposed in JMX -->
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
将false改成true。
不需重启,ServiceMix是热启动。再次执行命令
2.不知道指令怎么使用,是什么含义怎么办?
使用help指令会得到非常详细的解释。
例如:
karaf@root> helq activemq:list
Command not found: helq
karaf@root> help activemq:list
Task Usage: Main list [list-options]
Description: Lists all available broker in the specified JMX context.
List Options:
--jmxurl <url> Set the JMX URL to connect to.
--pid <pid> Set the pid to connect to (only on Sun JVM).
--jmxuser <user> Set the JMX user used for authenticating.
--jmxpassword <password> Set the JMX password used for authenticating.
--jmxlocal Use the local JMX server instead of a remote one.
--version Display the version information.
-h,-?,--help Display the stop broker help information.
3.如何查看前面例子中发送给activeMQ queue中消息?
使用指令
activemq:browse --amqurl tcp://localhost:61616 events