RMI Connectivity Issues

COMP 310    Java Resources  Eclipse Resources

(Back to the RMI Overview)

Solving RMI connectivity issues can be tricky.   Here are some things to keep in mind and some tactics to try.

 

Most RMI connectivity issues relate to blocked ports.  Be sure you know all the ports that your RMI program uses. RMI needs ports open for at least the following:

Registry -- the Java default Registry port is 1099, but Comp310 tends to use 2099 to avoid conflicts with other RMI-based programs such as DrJava.

Class File Server(s) -- The class file server supports dynamic class loading.   If you have two parts to your application that you wish or are able to run simultaneously on your computer, there may be at least two class file servers running at once.  Typical ports used in Comp310 for the class servers are ports 2001 - 2003.

All RMI "stubs" have a port associated with them -- It is best to explicitly specifiy the port when you create the stub rather than let Java pick a random port.  That way you can be sure that the port is open through your firewall.   We tend to use ports 2100-2102 for general purpose stubs but check with your particular application to make sure you know what port ranges you must deal with!

 

Make sure that your network is not designated as "Public"  (Windows only)

On Windows machines, if your network is set to "Public", you may experience problems ranging from slow connections to intermittent lack of packet transfer.    You should always have your network set to "Private" or "Home" or "Work".  

Win7:

  1. Open "Network and Sharing"  (right-click the network connection icon on the lower right tray)
  2. If the network connection (e.g. Rice Owls)  is described as public, click the word "public" which should be a link.
  3. In the ensuing dialog box, choose either Home or Work.  

Win8.0:

  1. Open the network fly-out on the right side of the screen that shows the available networks (left-clicking the network connection icon on the lower right tray).
  2. Right-click the network you are connected to (e.g. Rice Owls) and select "Turn sharing on or off"
  3. Select "Yes, turn on sharing and connect to devices"  

Win8.1:

(From http://community.spiceworks.com/how_to/show/18934-change-network-location-from-public-to-private-in-windows-8)

  1. Open Windows Explorer, and click on the Network Icon.
  2. When you do so, a notification message appears just below the address bar informing you that File Sharing is Turned Off.
  3. If you click on the message, you have the option to turn File Sharing On.
  4. If you click to turn file sharing on, it will ask if you want to Turn on File Sharing for all public networks; Here you select no, make this network private.
  5. You may need to disconnect from the network and reconnect for the new settings to take effect.

Or,

  1. From the desktop, open the right-side fly-out and select "Settings"
  2. Then select "Change PC Settings"
  3. Click on "Network"
  4. Turn sharing on.

Win10:

References:

You need to change the "Network Location" to private.   This can be done either by partially setting up a "Home Group" or by enabling sharing.

The above links detail directions on how to perform the changes, which differ depending on whether you are on a wired or wireless network.    Changing the network location as part off the Home Group setup is probably the easiest method -- note that the process does NOT require you to actually complete the set up of a new Home Group.

 

 

 

Determining port usage

Mac/Linux:

To show all port usage, open a command window and type the following (you will need to enter your password):

sudo lsof -i -n -P

Windows:

To show all port usage, open a command window "as administrator" and type the following:

netstat -anob -p tcp

Determining Startup Programs

A computer runs many programs behind the scenes that can potentially interfere with RMI.    It can take a bit of detective work to determine which program is causing any conflicts however, so do not expect this to be a quick solution.   Please inform the course staff of whatever you discover as this information could be very important to others with the same problem!

Mac:

Go to System Preferences then Accounts and then open LoginItems.    Click on the lock icon in the lower-left corner and enter your administrator password.   Highlighting a potentially conflicting program and clicking the "-" button will remove it from teh startup queue and it will not be running when you restart the system.   Suggestion:  write down the names and locations of the programs that you are removing so you can replace them later if they aren't causing the problem.

Windows:

Startup programs can be found in 3 different non-distinct places in Windows:

  1. In the taskbar area at the lower right of the screen.  Try exiting the various programs that appear here.   Note that in general, this will only temporarily disable the programs as they will re-appear when the system is restarted unless their preferences are changed to prevent the auto-start.

  2. The Startup folder in  Start menu  (Windows 7 and before) -- copy these items out this folder to somewhere else, e.g. your desktop, and then restart your system to see if they have an effect.

  3. The Startup tab in msconfig.    In the textfield of the Start menu of Windows 7  (or before) or in the Start tiles area of Windows 8, type msconfig.exe and run it.    In Win8, this will lead you to the Startup tab in the Task Manager, to which you could also go directly.   Startup programs can be disabled here.  Be careful though, as some programs are critical to stable system operation. 

 

Programs with Potential Port Conflicts:

Mac:

Chrome:

Sometimes RMI only works if Chrome is not  running .   This may be due to a plugin in Chrome using the ports.  If you are running a Mac, please send the staff an e-mail telling us if you were able or not able to run the RMIHelloWorld code and a list of all the plugins in your Chrome installation.

Windows:

Hamachi:

This tunneling program definitely conflicts with the RMI ports.   Disable the application.

 VMware:

 If you have ever run VMware on your machine, it may still be active.   One possible but not definite clue is that your network connections will show VMware connections along with the WiFi connection.   Go to the "Services" app in the Administrative Tools and disable all the services associated with VMware (there's 3-4 of them).   Be sure that the services are stopped.

 

Getting More Debugging Information

You can get Java to print out more verbose logging information during RMI transactions by setting the following system properties when RMI starts up:

System.setProperty("sun.rmi.loader.logLevel", "verbose");
System.setProperty("sun.rmi.server.logLevel", "verbose");
System.setProperty("sun.rmi.transport.logLevel", "verbose");

Here's a list of all the Java system properties related to RMI: http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/sunrmiproperties.html

 

Additional References

 

© 2020 by Stephen Wong