views:

114

answers:

1

I'm running the following code:

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class RmiClient {
    public static void main(String args[]) {
        try {
            String hostName = "hostnameChangedForOnlineReference";
            Registry registry = LocateRegistry.getRegistry(hostName, 1099);
            String[] names = registry.list();
            for (String name : names) {
                System.out.println(name);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }    
}

And getting the following error

java.rmi.ConnectIOException: non-JRMP server at remote endpoint
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:230)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.list(Unknown Source)
at RmiClient.main(RmiClient.java:9)

Yet other RMI code running on my machine connects to this same service just fine.

Can anyone suggest a path of investigation for this inconsistent behaviour on my machine?

(When I do rmi in spring I get exactly the same error, but this is an easier set of code to digest).

A: 
non-JRMP server at remote endpoint 

means that it turns out turning on SSL was required.

TLL