Results 1 to 3 of 3

Thread: passing remote objects via Spring RMI classes

  1. #1
    Join Date
    Sep 2007
    Posts
    5

    Default passing remote objects via Spring RMI classes

    Hi,

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

    http://jira.springframework.org/browse/SPR-982

    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. 

    http://forum.springsource.org/showth...n+serializable

    http://forum.springsource.org/showthread.php?t=14684


    Any help on this will be greatly appreciated!

    Thanks,

    Pat

  2. #2
    Join Date
    Apr 2008
    Location
    Seville, Spain
    Posts
    132

    Default

    I attach a working example to the old Jira issue https://jira.springsource.org/browse/SPR-982

    The code that I'm using is on
    http://sourceforge.net/p/jdal/code/c.../remoting/rmi/

    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.

    Cheers
    Last edited by chelu; Oct 19th, 2012 at 05:23 AM.
    Jose Luis Martin
    Freelance Senior Consultant
    JDAL - Java Database Application Library

  3. #3
    Join Date
    Apr 2008
    Location
    Seville, Spain
    Posts
    132

    Default

    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 http://sourceforge.net/p/jdal/code/c...rtin/remoting/ if some want want to test, use or improve it.

    Cheers
    Jose Luis Martin
    Freelance Senior Consultant
    JDAL - Java Database Application Library

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •