Results 1 to 2 of 2

Thread: Exposing a bean as RMI service to a non spring client

  1. #1

    Default Exposing a bean as RMI service to a non spring client

    I've managed to do a successful lookup of a RMI service outside the Spring container. The service is implemented as a "regular" remote object in another JVM not in a Spring container.

    When I tried to do the opposite, I ran into trouble:
    Exception in thread "main" java.lang.ClassCastException: org.springframework.remoting.rmi.RmiInvocationWrap per_Stub

    In order to be able to invoke remote methods in the client (not within a Spring container), I'd have to cast it to the interface.
    However, that does not seem to work.
    As far as I can conclude, RMI will be used just as the protocol for remote calls *between* 2 Spring containers. It cannot be used by a "regular" RMI client.

    Is the above a correct observation?
    Any insights and comments are most welcome.[/b]

  2. #2
    Join Date
    Nov 2004
    Location
    Zurich [CH]
    Posts
    14

    Default

    Hi,

    You're observations are mostly correct. If you have got a service interface, which does not fulfill the rmi rules (service interface extends java.rmi.Remote, every method throws a java.rmi.RemoteException and the rmic is runned with service implementation [only below jdk 1.5]) the remote calls will be tunneled through by using java refelction. This is made by class org.springframework.remoting.rmi.RmiInvocationWrap per, which has precomiled stub/skeletons in spring.jar.

    If you're using a service interface which fulfills the rmi rules, the service will be exported on server side as "real" rmi service. So also on client side a "real" service can be accessed by using classes which fulfilling the rmi rules.

    Cheers,
    Martin

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

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