PDA

View Full Version : JndiRmiServiceExporter problem (already exported)



schumnana
Sep 5th, 2005, 06:38 PM
Hi,

I have a problem with JndiRmiServiceExporter.

In my applicationContext.xml.

<bean id="helloService" class="org.springtest.service.HelloServiceImpl">
</bean>

<bean id="jndiRmiServiceExporter" class="org.springframework.remoting.rmi.JndiRmiServiceExp orter">
<property name="service" ref="helloService">
</property>
<property name="jndiName" value="HelloService"/>
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">com.sun.jndi.cosnaming.CNCtxFactory</prop>
<prop key="java.naming.provider.url">iiop://localhost:1050</prop>
</props>
</property>

</bean>


At runtime, I have this error.


Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jndiRmiServiceExporter' defined in class path resource [applicationContext-jdbc.xml]: Initialization of bean failed; nested exception is java.rmi.server.ExportException: org.springtest.service.HelloServiceImpl already exported
java.rmi.server.ExportException: org.springtest.service.HelloServiceImpl already exported
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObje ct.exportObject(PortableRemoteObject.java:85)
at javax.rmi.PortableRemoteObject.exportObject(Portab leRemoteObject.java:87)
at org.springframework.remoting.rmi.JndiRmiServiceExp orter.afterPropertiesSet(JndiRmiServiceExporter.ja va:94)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1058)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:363)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:275)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:318)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:81)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:66)
at org.springtest.Main.main(Main.java:58)

If someone has an idea ...

Alexandre



[/url]

schumnana
Sep 6th, 2005, 04:19 PM
I found the reason why I had the problem.

My HelloServiceImpl class extends PortableRemoteObject and must extend RemoteObject.

Alexandre