English-posts · Programmering · Teknologi

Java RMI connectivity debugging

19. februar 2015 · Ingen Kommentarer

When RMI connection fails with java.net.ConnectException: Connection refused it might be hard to figure out which hostname and port it tried to connect with, especially in third party libraries.

To enable debug logging in RMI connectivity, which logs hostname and port number, set this system property:
sun.rmi.transport.proxy.logLevel=BRIEF

Can also be set runtime with System.setProperty before RMI connections are made.

Log output are printed to console, such as:

Feb 19, 2015 1:03:28 PM sun.rmi.transport.proxy.RMIMasterSocketFactory createSocket
FINE: main: host: localhost, port: 1098
Feb 19, 2015 1:03:28 PM sun.rmi.transport.proxy.RMIMasterSocketFactory createSocket
FINE: main: host: localhost, port: 4444