问题描述:使用jmx监控activemq报错汇总:
1、报错:Exception in thread "main" java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 远程主机ip; nested exception is:
java.net.ConnectException: Connection timed out: connect]
at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at com.eastcom.collect.utils.Test2.main(Test2.java:32)
原因:没有关闭防火墙或者没有开启activemq
2、报错:java.lang.RuntimeException: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
原因:/etc/hosts文件没有配置实际ip地址。解决办法:需要将
1270.0.1 localhost
改为
实际ip地址 localhost