Disabling Notifd crashes webUI

Description

if you disable the Notifd service in service-configuration.xml, the WebUI will fail with present the following message in the browser:

"Error in WebUI"

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping#0' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/admin/notification/noticeWizard/eventNotices.htm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.opennms.netmgt.config.NotificationFactory org.opennms.web.controller.admin.notifications.EventNoticesController.m_notificationFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called.

Environment

Mac OS X, PostgreSQL 9.1, today's build of 15.0.1 (develop branch)

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Alejandro Galue February 6, 2015 at 12:13 PM

Fixed on revision d223c5d04ae0dcaa7673b2bd55a0d3606c15ede9 for develop, and cherry-picked on revision d413afea1501165fea650527716b89479ea9fd36 for release-15.0.1

Alejandro Galue February 6, 2015 at 12:05 PM

This is what I think it is:

Error creating bean with name 'notificationFactory-init' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: init() not called.

When creating an instance of NotificationFactory through Spring (because it is now defined at dispatcher-servlet.xml), the constructor is going to call NotifdConfigFactory.getInstance(), and that method is going to throw a IllegatStateException with a message that says "init() not called", which I think it is pretty straight forward winking face

So, the idea is to call NotifdConfigFactory.init() prior calling NotificationFactory.init() inside dispatcher-servlet.xml.

If Notifd is enabled, NotifdConfigFactory.init() will be called prior starting Jetty and that is why it works. But if Notifd is disabled, NotifdConfigFactory remains uninitialized.

I did the changes on my testing VM and it works now.

Fixed

Details

Assignee

Reporter

Fix versions

Affects versions

Priority

PagerDuty

Created February 5, 2015 at 5:55 PM
Updated February 6, 2015 at 5:12 PM
Resolved February 6, 2015 at 12:13 PM

Flag notifications