CMR - RMI ExportException

This page refers to the issue from ticket INSPECTIT-287 .

It may occur that the CMR is not able to start up and register two RMI services at one registry. The following exception is shown in CMR console:

2010-11-30 14:36:36,320 : Central Measurement Repository is starting up!
2010-11-30 14:36:36,322 : ==============================================
2010-11-30 14:36:36,322 : Initializing Spring...
2010-11-30 14:36:43,057 : |-Starting configuration module...
2010-11-30 14:36:43,058 : ||-Enhanced invocation storage mode: true
2010-11-30 14:36:43,575 : |-Registration Service active...
2010-11-30 14:36:43,584 : |-Agent Storage Service active...
2010-11-30 14:36:43,598 : Looking for RMI registry at port '1099'
2010-11-30 14:36:46,623 : Could not detect RMI registry - creating new one
2010-11-30 14:36:46,634 : Binding service 'inspectITRegistrationService' to RMI registry: RegistryImpl[UnicastServerRef [liveRef: [endpoint:[192.168.0.106:1099](local),objID:[0:0:0, 0]]]]
2010-11-30 14:36:46,651 : Looking for RMI registry at port '1099'
2010-11-30 14:36:49,654 : Could not detect RMI registry - creating new one
2010-11-30 14:36:49,655 : Unbinding RMI service 'inspectITRegistrationService' from registry at port '1099'
Exception in thread "main" org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:beanRefContext.xml], factory key [ctx];
 nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ctx' defined in URL [jar:file:/home/et/Desktop/CMR/inspectit-cmr.jar!/beanRefContext.xml]: Instantiation of bean failed;
 nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception;
�nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExporter#1' defined in class path resource [spring/spring-context-service.xml]: Invocation of init method failed;
�nested exception is java.rmi.server.ExportException: internal error: ObjID already in use
at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:389)
at info.novatec.inspectit.cmr.CMR.<init>(CMR.java:50)
at info.novatec.inspectit.cmr.CMR.main(CMR.java:95)

Problem Description

For each RMI service the CMR is trying to either create a new RMI registry or to use an already existing one. In this case a new RMI registry is created at:

endpoint:[192.168.0.106:1099](local),objID:[0:0:0, 0]

The second service to be registered is first looking for a registry and creates only a new RMI registry if no one was found. The problem here is that 192.168.0.106 is a wrong IP address that was taken from /etc/hosts, thus the IP resolution is wrong and the previously created RMI registry is not reachable. If now a second RMI registry is created, it throws an exception like this:

java.rmi.server.ExportException: internal error: ObjID already in use

Solution

Make sure that the IP resolution is correct by verifying that the entries in /etc/hosts are correct.