Announcement Announcement Module
No announcement yet.
passing remote objects via Spring RMI classes Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • passing remote objects via Spring RMI classes


    Iím trying to do something similar to what is described in Jira at this link:

    Essentially, Iíd like to create a remote object on a server that contains remote services as instance variables. Iím exporting this remote object on the server using RmiServiceExporter and calling it from the client using RmiProxyFactoryBean. This works fine. However, Iíd like to be able to get a reference to the remote services (contained within the remote object) on the client. Iíve been able to create the remote services within the remote object as proxys using RmiProxyFactoryBean, but when I call a method on the remote object from the client to return the proxy to one of the remote services, I get an exception saying that RmiProxyFactoryBean is not serializable.

    Iíve done a lot of web searches on this and also looked through the Spring Framework source code for classes RmiServiceExporter and RmiProxyFactoryBean, but I still have not been able to figure out a way to do this using Spring. The alternative is to do it using RMI classes, but that is definitely not my first choice.

    Iíve found the links below related to this issue, and based on what Iíve read so far, my understanding is that this cannot be done in a clean way with Spring. But before I give up on this effort, Iíd like to get confirmation of that. 

    Any help on this will be greatly appreciated!



  • #2
    I attach a working example to the old Jira issue

    The code that I'm using is on

    Export the client callback with provided RmiServiceExporter and pass the object returned by RmiServiceExporter.getRemoteService() to the remote server.

    If you don't want that client bind to the registy, set the DummyRegistry as registry on RmiServiceExporter.

    Last edited by chelu; Oct 19th, 2012, 05:23 AM.


    • #3
      Now, I need it working for HttpInvokers too, so I try a new approach.
      • Add RemotetClient interface to Proxies created by ProxyFactoryBeans that create a serializable reference with remote data.
      • Add a new RemoteInvocationFactory that look for RemoteClients on arguments and replace it with references
      • Add a new RemoteInvocationExecutor that exchange references with Proxies again on the other side.

      code is on if some want want to test, use or improve it.