Forums Register Login

RMI Help

+Pie Number of slices to send: Send
Hi,

I am starting to look into RMI and code my server.
I am new to this and dont know where to start.
Can anyone advise on any decent easy to follow tutorials on RMI that would relate to the type of server we need to build for the Developers Cert.

Also, I keep getting the following exception when trying to a sample server i setup..
java.rmi.server.ExportException: internal error: ObjID already in use

I have looked up all the posts on this site and see where other people had the same issue.
But I cant see how to fix it.

Here is my code;

Registry registry = LocateRegistry.createRegistry(1099);
registry.rebind("Service", new Server());

Please Help.
+Pie Number of slices to send: Send
Hi Sham,

Blatent plug: My book has a chapter devoted to how you can use RMI in a way suitable for this assignment

You can find the Sun RMI tutorial listed in the JavaRanch Reading Materials FAQ.

There is also the jGuru Remote Method Invocation (RMI) short course.

Both those later tutorials discuss RMI in general - it is up to you to apply them to the assignment.

As for the problem you mentioned, do you still get the same error if you use a port other than 1099?

If you dont get the error, then you may already have something listening on port 1099. The questions then would be: are you starting rmiregistry manually, or are you running a J2EE container (SunOne, JBoss, ...)?

If you do get the same error, then I would suspect that you are calling the createRegistry() method in more than one location.

Oh, and not that it is much help at the moment, but you should try and avoid "magic numbers" such as 1099. In that particular case you would probably be better using java.rmi.registry.Registry.REGISTRY_PORT

Regards, Andrew
+Pie Number of slices to send: Send
"netstat -a" from Windows command prompt will list the ports in use
+Pie Number of slices to send: Send
Sounds more like it's generated when trying to register the JNDI name. Are you sure you're not trying to register it twice by mistake?
+Pie Number of slices to send: Send
Hi guys, Thanks for all your responses.
I have figured out my problem.
I had the code in a constructor..so i was calling it twice.
It was late on Fri evening...and my head wasnt thinking straight,
Thats my excuse and I am sticking to it :-)

Andrew, thanks for the links and the plug...I must have a look for that book of yours.
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 672 times.
Similar Threads
Running RMI registry on ramdon port
java.net.UnknownHostException
I/O stream to List class????? argh!!
Running the RMI registry
object already exported exception with RMI
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 23:33:41.