PDA

View Full Version : Help : problem on starting RMI service via Spring


hevo
Dec 11th, 2004, 03:54 PM
Hi everyone.

When i start my Spring container with one rmi service, i get an error.
Can someone help me out !!
Thanks a lot

config

<beans>
<bean id="accountService"
class="com.iberville.account.AccountServiceSpringXMLImpl">

<property name="userAccounts">
<list>
<bean id="Account_1" class="com.iberville.account.classes.Account" singleton="false">
<property name="id"><value>jojo</value></property>
<property name="boxNumber"><value>1</value></property>
<property name="userName"><value>Jxx Wxxht</value></property>
<property name="password"><value>jojonumberone</value></property>
<property name="email"><value>josixx@yahoo.ca</value></property>
</bean>
<bean id="Account_2" class="com.iberville.account.classes.Account" singleton="false">
<property name="boxNumber"><value>2</value></property>
<property name="id"><value>hevo</value></property>
<property name="userName"><value>xx xxer</value></property>
<property name="password"><value>hevoNumberone</value></property>
<property name="email"><value>hxxer@vidxxn.ca</value></property>
</bean>
<bean id="Account_3" class="com.iberville.account.classes.Account" singleton="false">
<property name="boxNumber"><value>3</value></property>
<property name="id"><value>manu</value></property>
<property name="userName"><value>xxuel xxnd</value></property>
<property name="password"><value>manuNumberOne</value></property>
<property name="email"><value>mxx@yahoo.ca</value></property>
</bean>
</list>
</property>
</bean>


<bean class="org.springframework.remoting.rmi.RmiServiceExporte r">
<property name="serviceName">
<value>AccountService</value>
</property>
<property name="service">
<ref bean="accountService"/>
</property>
<property name="serviceInterface">
<value>com.iberville.services.AccountService</value>
</property>
<property name="registryPort">
<value>1199</value>
</property>
</bean>


</beans>



ERROR

[java] [2004-12-11 15:20:08,468 [main]] WARN org.springframework.remoting.rmi.RmiServiceExporte r - Could not detect RMI registry - creating new one
[java] [2004-12-11 15:20:08,468 [main]] INFO org.springframework.remoting.rmi.RmiServiceExporte r - Binding RMI service 'AccountService' to registry at port '1199'
[java] [2004-12-11 15:20:08,468 [main]] INFO org.springframework.beans.factory.support.DefaultL istableBeanFactory - Destroying singletons in factory {org.springframework.beans.factory.support.Default ListableBeanFactory defining beans [accountService,org.springframework.remoting.rmi.R miServiceExporter]; Root of BeanFactory hierarchy}
[java] [2004-12-11 15:20:08,468 [main]] DEBUG org.springframework.beans.factory.support.DefaultL istableBeanFactory - Retrieving dependent beans for bean 'accountService'
[java] [2004-12-11 15:20:08,484 [main]] DEBUG org.springframework.beans.factory.support.DefaultL istableBeanFactory - Applying DestructionAwareBeanPostProcessors to bean with name 'accountService'
[java] [2004-12-11 15:20:08,484 [main]] INFO org.springframework.beans.factory.support.DefaultL istableBeanFactory - Destroying inner beans in factory {org.springframework.beans.factory.support.Default ListableBeanFactory defining beans [accountService,org.springframework.remoting.rmi.R miServiceExporter]; Root of BeanFactory hierarchy}
[java] org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExport er' defined in class path resource [AccountService.xml]: Initialization of bean failed; nested exception is java.rmi.server.ExportException: object already exported
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute( ExecuteJava.java:172)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:7 05)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Jav a.java:177)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.ja va:83)
[java] at org.apache.tools.ant.UnknownElement.execute(Unknow nElement.java:275)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:34 1)
[java] at org.apache.tools.ant.Target.performTasks(Target.ja va:369)
[java] at org.apache.tools.ant.Project.executeTarget(Project .java:1214)
[java] at org.apache.tools.ant.Project.executeTargets(Projec t.java:1062)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAnt Runner.run(InternalAntRunner.java:377)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAnt Runner.main(InternalAntRunner.java:135)
[java] Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExport er' defined in class path resource [AccountService.xml]: Initialization of bean failed; nested exception is java.rmi.server.ExportException: object already exported
[java] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:300)
[java] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:205)
[java] at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:204)
[java] at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:136)
[java] at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:236)
[java] at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:284)
[java] at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:80)
[java] at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:65)
[java] at startup.<init>(startup.java:23)
[java] at startup.main(startup.java:13)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(Exec uteJava.java:193)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute( ExecuteJava.java:130)
[java] ... 11 more
[java] Caused by: java.rmi.server.ExportException: object already exported
[java] at sun.rmi.transport.ObjectTable.putTarget(Unknown Source)
[java] at sun.rmi.transport.Transport.exportObject(Unknown Source)
[java] at sun.rmi.transport.tcp.TCPTransport.exportObject(Un known Source)
[java] at sun.rmi.transport.tcp.TCPEndpoint.exportObject(Unk nown Source)
[java] at sun.rmi.transport.LiveRef.exportObject(Unknown Source)
[java] at sun.rmi.server.UnicastServerRef.exportObject(Unkno wn Source)
[java] at java.rmi.server.UnicastRemoteObject.exportObject(U nknown Source)
[java] at java.rmi.server.UnicastRemoteObject.exportObject(U nknown Source)
[java] at org.springframework.remoting.rmi.RmiServiceExporte r.afterPropertiesSet(RmiServiceExporter.java:160)
[java] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1057)
[java] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:287)
[java] ... 26 more
[java] --- Nested Exception ---
[java] org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExport er' defined in class path resource [AccountService.xml]: Initialization of bean failed; nested exception is java.rmi.server.ExportException: object already exported
[java] java.rmi.server.ExportException: object already exported
[java] at sun.rmi.transport.ObjectTable.putTarget(Unknown Source)
[java] at sun.rmi.transport.Transport.exportObject(Unknown Source)
[java] at sun.rmi.transport.tcp.TCPTransport.exportObject(Un known Source)
[java] at sun.rmi.transport.tcp.TCPEndpoint.exportObject(Unk nown Source)
[java] at sun.rmi.transport.LiveRef.exportObject(Unknown Source)
[java] at sun.rmi.server.UnicastServerRef.exportObject(Unkno wn Source)
[java] at java.rmi.server.UnicastRemoteObject.exportObject(U nknown Source)
[java] at java.rmi.server.UnicastRemoteObject.exportObject(U nknown Source)
[java] at org.springframework.remoting.rmi.RmiServiceExporte r.afterPropertiesSet(RmiServiceExporter.java:160)
[java] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1057)
[java] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:287)
[java] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:205)
[java] at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:204)
[java] at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:136)
[java] at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:236)
[java] at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:284)
[java] at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:80)
[java] at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:65)
[java] at startup.<init>(startup.java:23)
[java] at startup.main(startup.java:13)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(Exec uteJava.java:193)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute( ExecuteJava.java:130)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:7 05)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Jav a.java:177)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.ja va:83)
[java] at org.apache.tools.ant.UnknownElement.execute(Unknow nElement.java:275)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:34 1)
[java] at org.apache.tools.ant.Target.performTasks(Target.ja va:369)
[java] at org.apache.tools.ant.Project.executeTarget(Project .java:1214)
[java] at org.apache.tools.ant.Project.executeTargets(Projec t.java:1062)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAnt Runner.run(InternalAntRunner.java:377)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAnt Runner.main(InternalAntRunner.java:135)

hevo
Dec 11th, 2004, 04:52 PM
If the remote object extends UnicastRemoteObject Spring container crashes during load time.

timd
Mar 1st, 2005, 04:52 PM
Has this been resolved? I'm having the same problem...


I get a java.rmi.server.ExportException: object already exported...


Here's more detail about what I'm trying to do:
==================


If I allow spring to create an instance of my rmi object ( eg extends UnicastRemoteObject ), and then use RmiServiceExporter to make it available.

For example if i have a rmi capable class (e.g. RemoteFoo ) :

=============================

<bean id="theFoo" class="RemoteFoo"/>

<bean id="theFooRmi" class="org.springframework.remoting.rmi.RmiServiceExporte r">
<property name="service"><ref local="theFoo"/></property>
<property name="serviceInterface">
<value>IRemoteFoo</value>
</property>
<property name="serviceName"><value>theFooService</value></property>
<property name="registryPort"><value>1099</value></property>
</bean>

=================

Here is the full stack trace:

org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'theFooRmi' defined in file [c:\throwtest.server.xml]: Initialization of bean failed; nested exception is java.rmi.server.ExportException: object already exported
java.rmi.server.ExportException: object already exported
at sun.rmi.transport.ObjectTable.putTarget(Unknown Source)
at sun.rmi.transport.Transport.exportObject(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.exportObject(Un known Source)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(Unk nown Source)
at sun.rmi.transport.LiveRef.exportObject(Unknown Source)
at sun.rmi.server.UnicastServerRef.exportObject(Unkno wn Source)
at sun.rmi.server.UnicastServerRef.exportObject(Unkno wn Source)
at java.rmi.server.UnicastRemoteObject.exportObject(U nknown Source)
at java.rmi.server.UnicastRemoteObject.exportObject(U nknown Source)
at org.springframework.remoting.rmi.RmiServiceExporte r.afterPropertiesSet(RmiServiceExporter.java:225)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1065)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:343)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:260)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:221)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:282)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:82)
at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:67)
at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:58)
at bar.SpringDispenser.<init>(SpringDispenser.java:24)
at bar.SpringDispenser.init(SpringDispenser.java:33)
at throwtest.Server.main(Server.java:37)

davsclaus
Mar 2nd, 2005, 03:59 AM
If the remote object extends UnicastRemoteObject Spring container crashes during load time.

If it's a bug/defect I think a case in JIRA should be opened for this. Otherwise the developers of Spring isn't aware of this bug