問題描述:使用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