发表于: 2017-11-18 19:08:32

1 644


今日完成:

成功实现实现类rmi和spring集成rmi,在本地能运行,但是打包后不能运行。

明日计划:

解决今天的问题。

遇到的困难:

打出来的包运行时出现这个问题,经过排查是spring配置文件中的命名空间错误

xmlns:context="http://www.springframework.org/schema/context"

这个是注解驱动需要的命名空间,删除后可以实现功能,但是因为数据库操作和spring集成了,没有写实现类,而接口类不能直接实例化和声明为bean。

所以想解决这个问题的关键在打包,但是用了shade和boot打包都出现一个异常


上图的是shade的错误,但我已经设置了主函数入口,第二个似乎是依赖的jar包中有个类不存在还是什么原因。也不请楚,两点钟开始就在解决这个问题都解决不了。实在不行就不用注解注入了。


服务端代码:

<bean id="helloRMIServiceImpl" class="rmi.Service"> </bean>
<!-- 将一个类发布为一个RMI服务 -->
<bean id="RMIServer"  class="org.springframework.remoting.rmi.RmiServiceExporter">
   <property name="serviceName" value="helloRMI"/>
   <property name="service" ref="helloRMIServiceImpl"/>
   <property name="serviceInterface" value="rmi.ServiceDao"/>
   <property name="registryPort" value="4567"/>
</bean>

客户端代码

bean id="mobileAccountService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
   <property name="serviceUrl" value="rmia://localhost:4567/helloRMI" />
   <property name="serviceInterface"
             value="com.jnshu.dao.IMyServer" />
</bean>


进度:

任务八

任务开始时间:2017.11.16

预计demo时间:2017.11.20

禅道:http://task.ptteng.com/zentao/my-task.htm


返回列表 返回列表
评论

    分享到