I’m running a Java RMI application in which both client and server run on the same host, so that clients connects to server at localhost
. After I updated my system to JRE17 (Debian bookworm armhf), I experience issue: instead of connecting to 127.0.0.1
, client tries to access some random IP that looks like real routed IP but has nothing to do with anything in my system (it’s not my net or my uplink internet provider net).
When I use RMI debug logging (-Dsun.rmi.transport.tcp.logLevel=VERBOSE -Dsun.rmi.transport.logLevel=VERBOSE
), first messages says:
Jul 13, 2024 8:29:02 AM sun.rmi.transport.LiveRef <init>
FINE: main: localHostKnown = true, localHost = 212.58.187.34
Jul 13, 2024 8:29:03 AM sun.rmi.transport.tcp.TCPEndpoint getLocalEndpoint
FINE: main: Version = 2, ep = [212.58.187.34:1202]
So, localhost is somehow resolved to this strange IP. There is no such address on any network interface. There is no similar line in /etc/hosts
(it correctly sets localhost to 127.0.0.1), and all nameservers mentioned in /etc/resolv.conf
also doesn’t do it: when I send a request to resolve “localhost” name to them, a local SOHO router returns 127.0.0.1, and Google DNS (8.8.8.8) returns nothing.
However, if I remove all “nameserver” lines from resolv.conf, client starts working normally, connecting to 127.0.0.1. So it looks definitely connected to name resolution subsystem. It doesn’t look like a viable solution, obviously.
I tried to look for Java RMI source code, but the old one I’ve found doesn’t have anything about localHostKnown
value, and I can’t find code that is included to JRE 17.
Any help (including a link to JRE 17 RMI source code) would be appreciated.
ichthuss is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.