Can someone help me out, here?  I'm sure that some of you have solved this
problem long ago. . .  In fact, there is one thread in the Java-Linux archives
that deals
with this.  I tried putting my machine as the first line in /etc/hosts as suggested:

xxx.xxx.x.2 MyHostName MyHostName.mydomain.com
127.0.0.1 localhost localhost.localdomain

but that didn't work.

Here's the story:

I'm relatively new to Linux and Java and I'm trying to figure out how to get
past the known bug in RMI bind/rebind that throws an AccessException in, as
Sun puts it, "some network configurations."

I've read (in Thinking in Java) that this can be solved by having an open PPP
connection, but I don't have PPP set up on my Linux box.

My ethernet network has thus far run fine in terms of successfully running FTP
and HTTP servers, and consists of:

Linux box:
        MkLinux DR3 on a Mac G3 266 MHz minitower
        IP address of xxx.xxx.x.2
        default gateway of xxx.xxx.x.1
        JDK 1.1.6 v5
        
No nameserver is set up

A Mac PowerBook

An ethernet patch cable running between the two machines.


Here's the code I'm trying to run, plain vanilla taken straight out of the
Java.Sun site example:

**********
1:  The Remote Interface HelloInt

import java.rmi.*;

public interface HelloInt extends Remote {
        public String sayHello () throws java.rmi.RemoteException;
}

**********
2:  The main class HelloImpl

import java.rmi.*;
import java.rmi.server.*;
import java.net.*;

public class HelloImpl extends UnicastRemoteObject implements HelloInt {

        public String name;
        
        public HelloImpl (String s) throws RemoteException {
                super();
                name = s;
        }
        
        public String sayHello() throws RemoteException {
                return "Hello World!";
        }
        
        public static void main (String args []) {
        
                System.setSecurityManager (new RMISecurityManager());
        
                try {
                        HelloImpl h = new HelloImpl ("HelloServer");
                        System.out.println ("Attempting to rebind . . .");
                        Naming.rebind ("//localhost/HelloServer", h);
                        System.out.println ("Hello Server bound . . .");
                }
                catch (RemoteException re) {
                        System.out.println ("RemoteException in HelloImpl.main:  " +   
         re.getMessage());
                        re.printStackTrace();
                }
                catch (MalformedURLException e) {
                        System.out.println ("MalformedURLException in HelloImpl.main:  
" + e.getMessage());
                        e.printStackTrace();
                }
        
        }
}

Everything compiles. I start up rmiregistry. I run rmic on HelloImpl.I run
HelloImpl and it constructs the object 'h', but then I get the AccessException.

I've tried the following arg's for rebind to no avail:
        ("//localhost/HelloServer", h)
        ("//127.0.0.1/HelloServer", h)
        ("//xxx.xxx.x.2/HelloServer", h)
        ("//MyHostName/HelloServer", h)
        ("HelloServer", h)

The Sun documentation states:  "In some DHCP and PPP network configurations
the assigned IP address and hostname do not match the name assigned to the
node.  A workaround is to statically and explicitly assign the IP address for
the node."  Does that work, and how would I do that?

Do I actually need to have a PPP connection up and running to get this to run???

Thanks,

-DTB

Reply via email to