在搭建springboot+springcloud分佈式項目時遇到了這個問題:
java.io.IOException:The server sockets created using the LocalRMIServerSocketFactory only accept connections from clients running on the host where the RMI remote objects have been exported.
解決問題有兩種可能的解決方法:
1)修復etc主機
2)禁用本地主機檢查。
禁用本地主機檢查有兩種方法:
a)系統範圍:取消對行的註釋
#com.sun.management.jmxremote.local.only=false
在jre/lib/management/management.properties中
b)基於進程:pass-Dcom.sun.management.jmxremote.local.only=false 在java命令行(attachee端)
我的情況屬於第(2)種,當我釋放了 #com.sun.management.jmxremote.local.only=false 以後再次運行就正常了
奇怪的是,運行完成以後我再次把這行註釋掉髮現工程仍能正常運行,這個讓我覺得很奇怪