java.rmi.ConnectException: Connection refused to host: 127.0.1.1;

前端 未结 14 2625
攒了一身酷
攒了一身酷 2020-11-27 15:08
    java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
    java.net.ConnectException: Connection refused
    at sun.rmi.transport         


        
14条回答
  •  攒了一身酷
    2020-11-27 15:23

    I found many of the Q&A on this topic, not nothing was helping me - that's because my issue was more basic ( what can I say I am not a networking guru :) ). My ip address in /etc/hosts was incorrect. What I had tried included the following for CATALINA_OPTS:

    CATALINA_OPTS="$CATALINA_OPTS -Djava.awt.headless=true -Xmx128M -server 
    -Dcom.sun.management.jmxremote 
    -Dcom.sun.management.jmxremote.port=7091 
    -Dcom.sun.management.jmxremote.authenticate=false 
    -Dcom.sun.management.jmxremote.ssl=false
    -Djava.rmi.server.hostname=A.B.C.D"  #howeverI put the wrong ip here!
    
    export CATALINA_OPTS
    

    My problem was that I had changed my ip address many months ago, but never updated my /etc/hosts file. it seems that by default the jconsole uses the hostname -i ip address in some fashion even though I was viewing local processes. The best solution was to simply change the /etc/hosts file.

    The other solution which can work is to get your correct ip address from /sbin/ifconfig and use that ip address when specifying the ip address in, for example, a catalina.sh script:

    -Djava.rmi.server.hostname=A.B.C.D
    

提交回复
热议问题