设为首页 加入收藏

TOP

Spring+RMI+Hibernate发布多个服务(接口)思路
2014-11-24 02:53:22 来源: 作者: 【 】 浏览:0
Tags:Spring RMI Hibernate 发布 多个 服务 接口 思路

spring+RMI+hibernate发布多个服务(接口)思路,在配置的时候如果是两个服务,则发布两个RmiServiceExporter的bean。


客户端这边也在配置文件中设置两个bean定义RmiProxyFactoryBean。在调用的时候对不同的服务,使用不同的getBean。


例如:服务端的配置文件:

class="org.springframework.remoting.rmi.RmiServiceExporter">

LogPerson

com.hibernate.ILogPerson

1200


class="org.springframework.remoting.rmi.RmiServiceExporter">


Bay

com.hibernate.IBay


1200

客户端的配置文件:

class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
rmi://192.168.25.10:1200/LogPerson
com.hibernate.ILogPerson


class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
rmi://192.168.25.10:1200/Bay
com.hibernate.IBay


主程序中调用的方法:
//获得RMI服务
ILogPerson clientLog = (ILogPerson) cfactory.getBean("LogPerson");
IBay clientBay = (IBay) cfactory.getBean("Bay");
在做关联类的时候报错


问题:
Exception in thread "main" org.springframework.remoting.RemoteAccessException:
Could not access remote service [rmi://192.168.25.10:1199/BankService];
nested exception is java.rmi.MarshalException: error marshalling arguments;
nested exception is: java.io.NotSerializableException: springexample.hibernate.Account


at springexample.hibernate.TestClient.main(TestClient.java:40)
Caused by: java.rmi.MarshalException: error marshalling arguments; nested exception is:
Caused by: java.io.NotSerializableException: springexample.hibernate.Account


解决:
这个单词的意思居然没没明白marshalling arguments
就是用到的实体类没有从可以序列化类中继承过来啦!


相关阅读:


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Spring2.5.6+Hibernate3+RMI整合 下一篇通过Python Socket 管理系统时间

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: