Problem: When running a demo of Java's remote method invocation on our Ubuntu 9.04 based linux machines running java-6-openjdk the client could only attach to a server running on the same host.
Solution: Professor Ellman discovered that the fix is to explicitly tell the server its hostname or IP address. This is accomplished by adding ``-Djava.rmi.server.hostname=[IP or Name of HOST]`` to the java command when starting the server, so for a server named ``hopper`` with an IP address of ``10.0.0.63`` you can do either:
java -Djava.rmi.server.hostname=hopper hellormi.HelloServer
or
java -Djava.rmi.server.hostname=10.0.0.63 hellormi.HelloServer
both of which worked.
Without specifing this option the server is only listening on the loopbak device.
Note: these instruction are for the setup in the Vassar College Computer Science Department Lab. They may contain information not appropriate to an install elsewhere.
This setup will let you run your own tomcat webserver on the local machine for building and debugging apps in netbeans. There is one command to be typed in a terminal, all other steps will be preformed from within netbeans. Total time to complete these steps will depend more upon download speed of the plugins than any other factor, but it seems to take under 10 min. from the Lab. These instruction were tested with netbeans 6.5 and tomcat 6 installed from apt-get in ubuntu 9.04.
tomcat6-instance-create ~/mytomcat
Netbeans can be invoked either by typing ``netbeans`` in a terminal, or by menu selection. In Xfce4 it is on the ``Development`` menu.
You will need the plugins ``Java Web Applications`` and ``Tomcat``.
Depending on what you have done with netbeans in the past, some or all the needed plugins may already be installed. If you do not see one of the named plugins in the ``Available Plugins`` list, check the ``Installed`` tab. If it is there you have that one already.
To get to the ``Available Plugins`` list, select
When netbeans restarts, add the tomcat server. Select
When you select ``Close`` netbeans will save your server settings.
To do this, select
There are two likly causes of this. They each have a different solution. If you have a server running you can stop it. Sometimes, netbeans will think it has not started the tomcat server when it has. That can lead to this problem. If this happens, you must stop the server outside of netbeans (netbeans will not even give you the option so stop it as it does not think it is running). To stop the server from the command line, use the shutdown.sh script in your mytomcat/bin directory:
~/mytomcat/bin/shutdown.sh
Should do it. If it does not, then someone else has a server running. If that is the case you should do two things,
``Tools`` –> ``Servers`` –> ``Server Port``, increment it a bit. ``Close``. See if that helps.
— Greg Priest-Dorman 2009/09/30 16:41