0
我想实现与RMI和AOP的Spring应用程序。我的服务器组件有问题。如果接口扩展Remote
它的作品只是起点等精细RMI与春天和AOP
UnknownAdviceTypeException: Advice object [org.springframework.context.annotati[email protected]1f90645] is neither a supported subinterface of [org.aopalliance.aop.Advice] nor an [org.springframework.aop.Advisor]
:如果服务接口,我要揭露不延长Remote
和方法不抛出RemoteException
,我得到的错误。 我application.xml
只有一个豆声明:
<bean id="testService" class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName" value="TestService" />
<property name="service" ref="testServiceImpl"/>
<property name="serviceInterface"
value="xxx.service.TestService" />
</bean>
我的接口只有在@Transactional
注解,而实现具有@Service
注解。
在我的客户端,我也收到错误。在这里,我得到一个不是唯一的bean的错误:发现bean testService
和testServiceImpl
。我client.xml的是这样的:
<bean class="xxx.start.Client">
<property name="testService" ref="testService"/>
</bean>
<bean id="testService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl" value="rmi://localhost:1099/TestService"/>
<property name="serviceInterface" value="xxx.service.TestService"/>
</bean>
我跟着这个guide,但上面去的错误。如果你能帮助我很高兴。如果我运行没有RMI的JUnit测试,它的工作都很好
不要把'@ Transactional'在接口这会导致问题。把它放在你的实现上。有了这个设置,你现在有了一个代理服务器代理服务器。 –
@ M.Deinum但不是'@ Transactinal'为类中的所有方法打开一个事务?如果是的话,它也会为不需要的方法开放一个事务。我在impl上用'@ Transactional'对其进行了测试,并且我仍然得到关于建议的错误 – XtremeBaumer
无论它是否在界面上,它仍然会执行,它只会应用于公共方法(它应该只是您的接口方法)。 –