I am new to RMI and I am having trouble getting RMI and JBoss to work the way I thought they worked. I want to use JBoss's RMI registry to register my server object(s). I am running both the server and the client on the same machine (a Unix box w/ Solaris 5.8, Jboss/Jetty 3.04).
First, none of these classes is an EJB, just straight Java. I have a Remote interface, myRemote which extends Remote. This declares the methods I require the subclasses to have. I then have a server class, myClass, that extends UnicastRemoteObject and implements myRemote. The server, myClass, has the _stub and _skel files associated with it. All of these classes are in the same package, myPackagePath.
Here is what I've tried in code:
//this call does appear to get a valid registry object from JBoss
Registry reg = LocateRegistry.getRegistry("rmi://localhost", 4444);
//I then try to bind the remote object to the registry
reg.bind( "rmi://localhost:4444/myPackagePath.myClass", myClassInstance );
This generates the following error:
java.rmi.NoSuchObjectException: no such object in table
Another way I've tried this is with an InitialContext:
InitialContext i = new InitialContext();
i.bind( "rmi://localhost:4444/myPackagePath.myClass", myClassInstance );
which results in:
javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException:
no such object in table]
Naming.bind( "rmi://localhost:4444/myPackagePath.myClass", myClassInstance );
also yields: java.rmi.NoSuchObjectException: no such object in table
Now, I know this object isn't in the table yet -- I'm trying to add it there. Can someone help me with this at all? Do I need to make some changes in the JBoss config somewhere to tell it's RMI registry where to find the codebase? Is there something more I need to do in code?
Any help, or pointers to good resources would be appreciated.
Thanks in advance,