Provisiond fails with a Unable to return specified BeanFactory instance exception at startup

Description

Both on upgrade from earlier 1.8.6 and clean install (well, kept db + rrds intact, restored relevant parts of $OPENNMS_HOME/etc/), startup fails with this sequence:

------------------------------------------------------------------------------ Tue Mar 1 12:32:21 CET 2011
begin ulimit settings:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 137216
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 10240
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
end ulimit settings
Executing command: /opt/opennms/bin/runjava -r – -Djava.endorsed.dirs=/opt/opennms/lib/endorsed -Dopennms.home=/opt/opennms -Dcom.sun.management.jmxremote.port=18980 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Xmx4096m -Djava.net.preferIPv4Stack=true -Xms4096m -XX:+UseParallelGC -XX:MaxPermSize=128m -verbose:gc -jar /opt/opennms/lib/opennms_bootstrap.jar start
[DEBUG] System property 'opennms.library.jicmp' set to '/usr/lib64/libjicmp.so. Attempting to load jicmp library from this location.
[INFO] Successfully loaded jicmp library.
[GC 1048640K->78063K(4019584K), 0.0789320 secs]
[GC 1126703K->130065K(4019584K), 0.1472010 secs]
[GC 668341K->142097K(4019584K), 0.1265860 secs]
[Full GC 142097K->140850K(4019584K), 0.7638360 secs]
Mar 1, 2011 12:33:32 PM com.noelios.restlet.http.StreamClientHelper start
INFO: Starting the HTTP client
An error occurred while attempting to start the "OpenNMS:Name=Provisiond" service (class org.opennms.netmgt.daemon.SimpleSpringContextJmxServiceDaemon). Shutting down and exiting.
javax.management.RuntimeMBeanException: org.springframework.beans.factory.access.BootstrapException: Unable to return specified BeanFactory instance: factory key [provisiondContext], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'provisiondContext' defined in URL [jar:file:/opt/opennms/lib/opennms-provisiond-1.8.10.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 'adapterManager' defined in class path resource [META-INF/opennms/applicationContext-provisiond.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rancidProvisioningAdapter' defined in URL [jar:file:/opt/opennms/lib/opennms-rancid-1.8.10.jar!/META-INF/opennms/provisiond-extensions.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrow(DefaultMBeanServerInterceptor.java:856)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrowMaybeMBeanException(DefaultMBeanServerInterceptor.java:869)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:838)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.opennms.netmgt.vmmgr.Invoker.invoke(Invoker.java:338)
at org.opennms.netmgt.vmmgr.Invoker.invokeMethods(Invoker.java:261)
at org.opennms.netmgt.vmmgr.Starter.start(Starter.java:266)
at org.opennms.netmgt.vmmgr.Starter.startDaemon(Starter.java:137)
at org.opennms.netmgt.vmmgr.Controller.start(Controller.java:202)
at org.opennms.netmgt.vmmgr.Controller.main(Controller.java:174)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.opennms.bootstrap.Bootstrap$3.run(Bootstrap.java:352)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.factory.access.BootstrapException: Unable to return specified BeanFactory instance: factory key [provisiondContext], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'provisiondContext' defined in URL [jar:file:/opt/opennms/lib/opennms-provisiond-1.8.10.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 'adapterManager' defined in class path resource [META-INF/opennms/applicationContext-provisiond.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rancidProvisioningAdapter' defined in URL [jar:file:/opt/opennms/lib/opennms-rancid-1.8.10.jar!/META-INF/opennms/provisiond-extensions.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:409)
at org.opennms.core.utils.BeanUtils.getBeanFactory(BeanUtils.java:59)
at org.opennms.core.utils.BeanUtils.getFactory(BeanUtils.java:101)
at org.opennms.netmgt.daemon.AbstractSpringContextJmxServiceDaemon.init(AbstractSpringContextJmxServiceDaemon.java:109)
at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)
at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120)
at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
... 13 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'provisiondContext' defined in URL [jar:file:/opt/opennms/lib/opennms-provisiond-1.8.10.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 'adapterManager' defined in class path resource [META-INF/opennms/applicationContext-provisiond.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rancidProvisioningAdapter' defined in URL [jar:file:/opt/opennms/lib/opennms-rancid-1.8.10.jar!/META-INF/opennms/provisiond-extensions.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:285)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:993)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:897)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1049)
at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:397)
... 25 more
Caused by: 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 'adapterManager' defined in class path resource [META-INF/opennms/applicationContext-provisiond.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rancidProvisioningAdapter' defined in URL [jar:file:/opt/opennms/lib/opennms-rancid-1.8.10.jar!/META-INF/opennms/provisiond-extensions.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:107)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:277)
... 35 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adapterManager' defined in class path resource [META-INF/opennms/applicationContext-provisiond.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rancidProvisioningAdapter' defined in URL [jar:file:/opt/opennms/lib/opennms-rancid-1.8.10.jar!/META-INF/opennms/provisiond-extensions.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:105)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
... 37 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rancidProvisioningAdapter' defined in URL [jar:file:/opt/opennms/lib/opennms-rancid-1.8.10.jar!/META-INF/opennms/provisiond-extensions.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:387)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1116)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:266)
at org.opennms.netmgt.provision.service.DefaultPluginRegistry.beansOfType(DefaultPluginRegistry.java:148)
at org.opennms.netmgt.provision.service.DefaultPluginRegistry.getAllPlugins(DefaultPluginRegistry.java:128)
at org.opennms.netmgt.provision.service.ProvisioningAdapterManager.afterPropertiesSet(ProvisioningAdapterManager.java:75)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
... 53 more
Caused by: java.lang.NullPointerException
at org.opennms.netmgt.provision.RancidProvisioningAdapter.getSuitableRancidNodeAuthentication(RancidProvisioningAdapter.java:615)
at org.opennms.netmgt.provision.RancidProvisioningAdapter.getSuitableRancidNode(RancidProvisioningAdapter.java:584)
at org.opennms.netmgt.provision.RancidProvisioningAdapter.buildRancidNodeMap(RancidProvisioningAdapter.java:200)
at org.opennms.netmgt.provision.RancidProvisioningAdapter.access$000(RancidProvisioningAdapter.java:83)
at org.opennms.netmgt.provision.RancidProvisioningAdapter$1.doInTransaction(RancidProvisioningAdapter.java:165)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.opennms.netmgt.provision.RancidProvisioningAdapter.afterPropertiesSet(RancidProvisioningAdapter.java:163)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
... 67 more

Environment

Oracle Enterprise Linux 5.5, Linux opennms.ihelse.net 2.6.18-194.32.1.0.1.el5 #1 SMP Tue Jan 4 16:26:54 EST 2011 x86_64 x86_64 x86_64 GNU/Linux, Oracle jdk # cat java.conf /usr/java/jdk1.6.0_24/bin/java (from latest jdk-6u24-linux-x64-rpm.bin off Oracle's site)

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Seth Leger September 12, 2011 at 4:41 PM

I've added some defensive code to prevent this exception from being thrown. However in the mean time, if you are not using it then you should uninstall the opennms-plugin-provisioning-rancid package which performs RANCID integration via provisiond. This is the package that is causing this exception.

commit a842903f6a51fe083170f36984f6caa47e9af62c

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

PagerDuty

Created March 1, 2011 at 6:46 AM
Updated January 27, 2017 at 4:21 PM
Resolved September 12, 2011 at 4:41 PM