Bug 965342 - Alert updates; Hibernate lazy load exception for Numeric Type
Summary: Alert updates; Hibernate lazy load exception for Numeric Type
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Alerts
Version: 4.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHQ 4.8
Assignee: Heiko W. Rupp
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-21 00:56 UTC by Elias Ross
Modified: 2013-09-11 09:53 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-11 09:53:10 UTC
Embargoed:


Attachments (Terms of Use)

Description Elias Ross 2013-05-21 00:56:32 UTC
2013-05-21 00:45:07,106 WARN  [org.rhq.enterprise.gui.coregui.server.gwt.AlertTemplateGWTServiceImpl] Sending exception to client: [1369097107106] 
org.rhq.enterprise.server.alert.AlertDefinitionUpdateException: Failed to update child AlertDefinitions [15555, 15556, 15557, 15558, 15559, 15560, 15561, 1556
2, 15563, 15564, 15565, 15566, 15567, 15568, 15569, 15570, 15571, 15572]; 
        at org.rhq.enterprise.server.alert.AlertTemplateManagerBean.updateAlertTemplate(AlertTemplateManagerBean.java:307)

...

Caused by: org.hibernate.LazyInitializationException: could not initialize proxy - no Session
        at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
        at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
        at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:166)
        at org.rhq.core.domain.measurement.MeasurementDefinition_$$_javassist_36.getNumericType(MeasurementDefinition_$$_javassist_36.java)

The bug is probably fixed with this:

diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java b/modules/enterprise/server/jar/src/m
index 0b3ff87..84c9872 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java
@@ -650,9 +650,9 @@ private void checkAlertDefinition(Subject subject, AlertDefinition persistedAler
             if (alertConditionCategory == AlertConditionCategory.BASELINE) {
 
                 MeasurementDefinition def = alertCondition.getMeasurementDefinition();
+                def = entityManager.getReference(MeasurementDefinition.class, def.getId());
                 NumericType numType = def.getNumericType();
                 if (numType == null) {
-                    def = entityManager.getReference(MeasurementDefinition.class, def.getId());
                     numType = def.getNumericType();
                 }
                 if (numType != NumericType.DYNAMIC) {

Comment 1 Heiko W. Rupp 2013-06-18 15:21:05 UTC
To reproduce:

create an alert template with a Baseline.
save it.
Then edit the template and edit the baseline condition. Save.

Comment 2 Heiko W. Rupp 2013-06-18 15:36:33 UTC
master 26b1b5e27

Comment 3 Heiko W. Rupp 2013-09-11 09:53:10 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.


Note You need to log in before you can comment on or make changes to this bug.