Announcement Announcement Module
Collapse
No announcement yet.
Exposing a bean as RMI service to a non spring client Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment

    Working...
    X