Java Spring RMI-查找RMI存根失败

Java Spring RMI-查找RMI存根失败,java,spring,rmi,Java,Spring,Rmi,我使用的是Spring3.2,在尝试基于“远程”RMI服务创建bean定义时出现以下错误。客户端和服务器都在同一台主机上实现 org.springframework.remoting.RemoteLookupFailureException: Lookup of RMI stub failed; nested exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is: ja

我使用的是Spring3.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;
公共类TestRmiServiceImpl实现TestRmiService{
公共字符串doSomething(){
回复“你好”;
} 
}
我使用netstat进行了检查,该服务似乎正在端口1099上运行。
任何想法都将受到欢迎-提前感谢。

问题可能是Glassfish不喜欢通过“后门”打开的RMI连接。我建议通过HTTP调用程序实现远程处理: