Bug 965350

Summary: NPE in AlertManagerBean when RHQ starts up
Product: [Other] RHQ Project Reporter: Elias Ross <genman>
Component: AlertsAssignee: Heiko W. Rupp <hrupp>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.5CC: hrupp
Target Milestone: ---   
Target Release: RHQ 4.8   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-11 09:52:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Elias Ross 2013-05-21 01:57:59 UTC
2013-05-21 01:37:04,470 WARN  [org.rhq.enterprise.server.alert.AlertManagerBean] MasterServerPluginContainer is not started yet
2013-05-21 01:37:04,470 ERROR [org.rhq.enterprise.server.alert.AlertManagerBean] Failed to send all notifications for Alert[id=64380]
java.lang.NullPointerException
        at org.rhq.enterprise.server.alert.AlertManagerBean.sendAlertNotifications(AlertManagerBean.java:679)
        at org.rhq.enterprise.server.alert.AlertManagerBean.fireAlert(AlertManagerBean.java:646)
        at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
        at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
        at org.rhq.enterprise.server.common.PerformanceMonitorInterceptor.monitorHibernatePerformance(PerformanceMonitorInterceptor.java:32)
        at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)



    public void sendAlertNotifications(Alert alert) {
        /*
         * make this method public in case we show the notification failure to the user in the UI in the future and want
         * to give them some way to explicitly try to re-send the notification for some client-side auditing purposes
         */
        try {
            if (log.isDebugEnabled()) {
                log.debug("Sending alert notifications for " + alert.toSimpleString() + "...");
            }
            List<AlertNotification> alertNotifications = alert.getAlertDefinition().getAlertNotifications();

            if (alertNotifications != null && alertNotifications.size() > 0) {
                AlertSenderPluginManager alertSenderPluginManager = getAlertPluginManager();

....

                        AlertSender<?> notificationSender = alertSenderPluginManager
                            .getAlertSenderForNotification(alertNotification);
                        if (notificationSender == null) {
                            notificationLog = new AlertNotificationLog(alert, senderName, ResultState.FAILURE,
                                "Failed to obtain a sender with given name");



getAlertPluginManager() can return null, causing trouble later on... At the very least this should be avoided. The plugin container should not try to send alerts when plugin manager is null.

Comment 1 Heiko W. Rupp 2013-06-19 13:50:24 UTC
master 6543f98

Comment 2 Heiko W. Rupp 2013-09-11 09:52:30 UTC
Bulk closing of old issues now that HRQ 4.9 is in front of the door.

If you think the issue has not been solved, then please open a new bug and mention this one in the description.