Spring 3.2 を使用していますが、「リモート」RMI サービスに基づいて Bean 定義を作成しようとすると、次のエラーが発生します。クライアントとサーバーの両方が同じホストに実装されています。
org.springframework.remoting.RemoteLookupFailureException:
Lookup of RMI stub failed; nested exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.EOFException.
Glassfish 3.1.2 にデプロイしようとしています。関連するコードは次のようになります-
spring-servlet.xml
<!-- Remoting Config (server) -->
<bean id="testRmiService" class="com.test.backend.rmi.TestRmiServiceImpl" />
<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName" value="CountryService"/>
<property name="service" ref="testRmiService"/>
<property name="serviceInterface" value="com.test.backend.rmi.TestRmiService"/>
<property name="registryPort" value="1099"/>
</bean>
<!-- Remoting Config (client) -->
<bean id="helloService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl" value="rmi://localhost:1099/CountryService"/>
<property name="serviceInterface" value="com.test.backend.rmi.TestRmiService"/>
</bean>
package com.test.backend.rmi;
public interface TestRmiService {
public String doSomething();
}
package com.test.backend.rmi;
public class TestRmiServiceImpl implements TestRmiService {
public String doSomething() {
return "hello";
}
}
netstat を使用して確認したところ、サービスはポート 1099 で実行されているようです。