SPring based RMI service + Plain old RMI Client
Is spring based RMI server compatible with a simple RMI client (plain old RMI client - not spring based) ?
I have been trying to get this combination working. But no luck. Does the RMI client has to be spring based too ?
Server side xml configuration -
<bean class="org.springframework.remoting.rmi.RmiService Exporter">
<property name="serviceName" value="remoteJournalOperationServiceNm"/>
<property name="service" ref="remoteJournalOperationService"/>
<property name="serviceInterface" value="com.ubs.pb.cts.services.client.JorunalOpera tions"/>
<property name="registryPort" value="${rmi.remoteSvc.port}"/>
</bean>
<bean id="remoteJournalOperationService" class="com.ubs.pb.cts.services.client.JorunalOpera tionsImpl"></bean>
Client side -
static public void main(String args[])
{
Object rmiServer; //=> Need this to be defined as JorunalOperations -
Registry registry;
String serverAddress="localhost";
String serverPort="1234";
System.out.println("sending to "+serverAddress+":"+serverPort);
try{
// get the
registry=LocateRegistry.getRegistry(serverAddress, (new Integer(serverPort)).intValue());
//=>>> look up the remote object as JorunalOperations - but throws ClassCastException here -
rmiServer=(registry.lookup("remoteJournalOperation ServiceNm"));
System.out.println("Successfully connected");
// call the remote method
rmiServer.cancelJournal(1234, 1, "Makarand");
}
catch(RemoteException e){
e.printStackTrace();
}
catch(NotBoundException e){
e.printStackTrace();
}
}
I am trying out the spring based RMI server configuration for the first time - But not sure if this is compatible with the typical RMI way of doing it ? Pls advice ...