How do I have to configure a RMI environment so that I'm able to use it in a “real” network?

前端 未结 2 746
囚心锁ツ
囚心锁ツ 2021-01-03 17:13

Because I didn\'t want to implement a communication protocol for my client-server based application, I implemented a RMI client and a RMI server on both sides for the inform

相关标签:
2条回答
  • 2021-01-03 17:47

    Using different versions of the JDK on each server could cause this problem.

    Use the java -version command to make sure that you are using the same version of the jre.

    0 讨论(0)
  • 2021-01-03 17:50

    You need to add an entry to the hosts file of the machines containing an entry of the form

    machinename    privateip
    

    e.g.

    virtualmachine    192.168.1.16
    

    This will prevent RMI from sending the localhost host name as a 'call me back' address.

    To test this approach, run the following code before and after performing the change.

    System.out.println(java.net.InetAddress.getLocalHost());
    

    It should output a local address before the changes and a non-local address after the changes.

    0 讨论(0)
提交回复
热议问题