【问题标题】:Spring RMI - Lookup of RMI stub failedSpring RMI - 查找 RMI 存根失败
【发布时间】:2013-09-18 17:24:13
【问题描述】:

我正在使用 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 上运行。 任何想法都值得赞赏 - 在此先感谢。

【问题讨论】:

    标签: java spring rmi


    【解决方案1】:

    问题可能是 Glassfish 不喜欢通过“后门”打开的 RMI 连接。我宁愿建议通过 HTTP Invoker 实现远程处理:http://www.javatpoint.com/spring-remoting-by-http-invoker-example

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-30
      • 1970-01-01
      • 2016-03-08
      • 1970-01-01
      • 2017-10-24
      相关资源
      最近更新 更多