Hi All,

I need to set up my RMI through SSL so I set registryClientSocketFactory with SslRMIClientSocketFactory instance. It work fine if I only run 1 RMI services, however when I try to export 2 interfaces I get the following error:


Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dummyDOExporter' defined in class path resource [au/bt/stp/rmi-server-config.xml]: Invocation of init method failed; nested exception is java.rmi.server.ExportException: internal error: ObjID already in use
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1362)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:540)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:485)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 51)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:169)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:170)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:413)
at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:735)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:369)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:122)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:66)
at au.bt.stp.RMIRunner.main(RMIRunner.java:9)
Caused by: java.rmi.server.ExportException: internal error: ObjID already in use

Any idea?

Note, I also find this:
If I use default registryClientSocketFactory from Spring, it works fine.
As I can only have one port for registryPort, I have set it to registryPort=1099. Technically, we only need a registryPort and many servicePort for RMI right?

Please help. THank you very much

Code:
<bean id="stpExporter" class="org.springframework.remoting.rmi.RmiServiceExporter">
		<property name="serviceName" value="stpProcess"/>
		<property name="serviceInterface" value="au.bt.stp.stpProcess"/>
		<property name="service" ref="stpProcess"/>
		<property name="registryPort" value="1099"/>
		<property name="registryClientSocketFactory" ref="SslRMIClientSocketFactory"></property>
	</bean>
	
	<bean id="dummyDOExporter" class="org.springframework.remoting.rmi.RmiServiceExporter">
		<property name="serviceName" value="dummyDO"/>
		<property name="serviceInterface" value="au.bt.stp.dummyDO"/>
		<property name="service" ref="dummyDO"/>
		<property name="registryPort" value="1099"/>
		<property name="registryClientSocketFactory" ref="SslRMIClientSocketFactory"></property>
	</bean>
	
	<bean id="stpProcess" class="au.bt.stp.stpProcessImpl"/>
	<bean id="dummyDO" class="au.bt.stp.dummyDOImp"/>
	<bean id="SslRMIClientSocketFactory" class="javax.rmi.ssl.SslRMIClientSocketFactory"></bean>