Forums Register Login

Using Sockets to pass an RMI Reference

+Pie Number of slices to send: Send
Hi,

I have 2 processes A and B.
Both already communicate via Sockets.

I need B to use a callback on an object in A.
This is an RMI Object.

When I pass the Reference to the RMI object in a serialized Object to B, B involkes the callback method.

However The callback is executed on B.
i.e. It looks like the Remote RMI Object is serialized accross to B and B then involkes the method on the newly created RMI object living in its process.

I have tried passing Interface refs, Object Refs and RemoteRefs but to no avail.

I can't see the issue as I thought java will not serialize any object which extends remote.

Any ideas

Thanks
+Pie Number of slices to send: Send
Can you post some code so that we know what we are talking about?
+Pie Number of slices to send: Send
You cannot send a remote object reference over the wire and call it. That's not how it works. There is a Remote interface. Your remote interface extends that. Your remote class impelements the interface. You must then deploy your remote interface to an RMI server to indicate where the actual remote object lives. The client (e.g., socket B) does a lookup in the registry and gets an instance of the remote proxy that implements the remote interface. The proxy calls are marshalled over the wire to the actual object on the remote server.
Can't .... do .... plaid .... So I did this tiny ad instead:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 910 times.
Similar Threads
RMI question
getConnection throwing NotSerializableException
Pass by value and Pass by reference
IIOP protocol
objects passed by reference
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:47:40.