Announcement Announcement Module
Collapse
No announcement yet.
Spring Remoting server side but no spring client side Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Remoting server side but no spring client side

    Hi,
    i have server running with RMI spring-remoting 2.5.6
    <bean id="hellloServerServiceExporter" class="org.springframework.remoting.rmi.RmiService Exporter">
    <property name="serviceName" value="Hello" />
    <property name="service" ref="helloServerService" />
    <property name="serviceInterface" value="com.remote.rmi.server.hello.contract.IHello Service" />
    <property name="registryPort" value="9000" />
    </bean>

    when i test my service with a client with spring, it works.
    <bean id="helloServiceProxy" class="org.springframework.remoting.rmi.RmiProxyFa ctoryBean">
    <property name="serviceUrl" value="rmi://localhost:9000/Hello" />
    <property name="serviceInterface" value="com.remote.rmi.client.hello.contract.IHello Service" />
    </bean>

    BUT the final client will not run with spring at all: it is not negotiable!!!
    So when i try, the code above:
    Registry registry = LocateRegistry.getRegistry("localhost", 9000);
    IHelloService hello = (IHelloService) registry.lookup(name);

    I get this error on the second line :
    java.lang.ClassCastException: org.springframework.remoting.rmi.RmiInvocationWrap per_Stub

    If i understand well: the stub resulted by org.springframework.remoting.rmi.RmiServiceExporte r is wrapped into a spring object (as the proxy invoked within the spring client side test), whereas the java.rmi.registry.Registry expects a pure java service.

    I have not found much info about this issue:
    http://forum.springsource.org/showth...onWrapper_Stub
    But the conclusion is not clear for me and it was few years ago...

  • #2
    For information, the answer is : yes, it is possible.
    The interface service should extend java.rmi.Remote and the implemented service should extend java.rmi.server.RemoteObject. Thus, the service methods should throw RemoteException.
    Then, the service should return an rmi proxy stub and not a spring stub anymore.

    Comment

    Working...
    X