Bug 695753 - Cannot view traits for any resource on monitoring tab
Cannot view traits for any resource on monitoring tab
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: Monitoring (Show other bugs)
4.0.0
Unspecified Unspecified
medium Severity high (vote)
: ---
: ---
Assigned To: Jay Shaughnessy
Corey Welton
:
: 697039 (view as bug list)
Depends On:
Blocks: rhq4
  Show dependency treegraph
 
Reported: 2011-04-12 11:12 EDT by John Sanda
Modified: 2011-10-04 15:22 EDT (History)
4 users (show)

See Also:
Fixed In Version: 4.0.1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Sanda 2011-04-12 11:12:23 EDT
Description of problem:
When trying to view traits for any resource, I the following error message:

Failed to fetch traits for criteria [org.rhq.core.domain.criteria.MeasurementDataTraitCriteria@3fef]

with this exception in the log:

Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: group of: org.rhq.core.domain.measurement.MeasurementDataTrait [SELECT measurementdatatrait
FROM org.rhq.core.domain.measurement.MeasurementDataTrait measurementdatatrait
LEFT JOIN measurementdatatrait.schedule.definition orderingField0
WHERE ( measurementdatatrait.schedule.resource.id IN ( SELECT res.id     FROM org.rhq.core.domain.resource.Resource res     JOIN res.implicitGroups ig    WHERE ig.id = :groupId ) 
AND measurementdatatrait.id.timestamp = ( SELECT MAX(mdt.id.timestamp)     FROM org.rhq.core.domain.measurement.MeasurementDataTrait mdt    WHERE mdt.id.scheduleId = measurementdatatrait.id.scheduleId )      AND 1 = :maxTimestamp )
 AND ( measurementdatatrait.group.id IN ( SELECT measurementdatatrait.group.id 
                    FROM measurementdatatrait innerAlias 
                    JOIN innerAlias.group.roles r JOIN r.subjects s 
                   WHERE s.id = 10001 )
  OR
  measurementdatatrait.group.id IN ( SELECT measurementdatatrait.group.id 
                    FROM measurementdatatrait innerAlias 
                    JOIN innerAlias.group.clusterResourceGroup crg JOIN crg.roles r JOIN r.subjects s 
                   WHERE crg.recursive = true AND s.id = 10001 )
  OR
  measurementdatatrait.group.id IN ( SELECT measurementdatatrait.group.id
                    FROM measurementdatatrait innerAlias 
                    JOIN innerAlias.group.subject s
                   WHERE s.id = 10001 ) ) 

ORDER BY orderingField0.displayName ASC
]
	at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:616)
	at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:95)
	at org.jboss.ejb3.entity.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:134)
	at org.rhq.enterprise.server.util.CriteriaQueryGenerator.getQuery(CriteriaQueryGenerator.java:743)
	at org.rhq.enterprise.server.util.CriteriaQueryRunner.getCollection(CriteriaQueryRunner.java:98)
	at org.rhq.enterprise.server.util.CriteriaQueryRunner.execute(CriteriaQueryRunner.java:69)
	at org.rhq.enterprise.server.measurement.MeasurementDataManagerBean.findTraitsByCriteria(MeasurementDataManagerBean.java:851)
	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.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.GeneratedMethodAccessor182.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
	at org.rhq.enterprise.server.common.TransactionInterruptInterceptor.addCheckedActionToTransactionManager(TransactionInterruptInterceptor.java:77)
	at sun.reflect.GeneratedMethodAccessor181.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
	at org.rhq.enterprise.server.authz.RequiredPermissionsInterceptor.checkRequiredPermissions(RequiredPermissionsInterceptor.java:156)
	at sun.reflect.GeneratedMethodAccessor180.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
	... 97 more

Version-Release number of selected component (if applicable):


How reproducible:
always


Steps to Reproduce:
1. For any resource that has monitoring enabled, go to the Monitoring tab.
2. Go to the Traits subtab.
3.
  
Actual results:
No traits are displayed and I get this error message,

Failed to fetch traits for criteria [org.rhq.core.domain.criteria.MeasurementDataTraitCriteria@3fef]


Expected results:
Should see traits and no exception in the server log

Additional info:
Comment 1 John Sanda 2011-04-12 11:16:37 EDT
The stack trace in the description actually shows the problem for a group. Note in the stack trace that it specified that it cannot resolve the property 'group'. For an individual resource the stack trace is slightly different,

Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: resource of: org.rhq.core.domain.measurement.MeasurementDataTrait [SELECT measurementdatatrait
FROM org.rhq.core.domain.measurement.MeasurementDataTrait measurementdatatrait
LEFT JOIN measurementdatatrait.schedule.definition orderingField0
WHERE ( measurementdatatrait.schedule.resource.id = :resourceId 
AND measurementdatatrait.id.timestamp = ( SELECT MAX(mdt.id.timestamp)     FROM org.rhq.core.domain.measurement.MeasurementDataTrait mdt    WHERE mdt.id.scheduleId = measurementdatatrait.id.scheduleId )      AND 1 = :maxTimestamp )
 AND ( measurementdatatrait.resource.id IN ( SELECT measurementdatatrait.resource.id 
                    FROM measurementdatatrait innerAlias 
                    JOIN innerAlias.resource.implicitGroups g JOIN g.roles r JOIN r.subjects s 
                   WHERE s.id = 10001 ) )

ORDER BY orderingField0.displayName ASC
Comment 2 John Sanda 2011-04-12 12:28:27 EDT
It looks like I only get these exceptions when traits have not yet been reported by the agent. When I go to view traits after the agent has reported metrics, I do not get any exceptions.
Comment 3 John Sanda 2011-04-18 10:03:20 EDT
These exceptions occur only when the user is not an inventory manager. I was starting to think that this might be an issue with CriteriaQueryGenerator, but I am also see this type of issue with MeasurementDataTraitCriteria, so it does in fact seem specific to this criteria.
Comment 4 Charles Crouch 2011-04-18 20:14:47 EDT
*** Bug 697039 has been marked as a duplicate of this bug. ***
Comment 5 Jay Shaughnessy 2011-04-19 12:52:25 EDT
commit b782d25b0bfbfa844a1061f67797edcc085eb8e0
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Tue Apr 19 11:57:11 2011 -0400

    [BZ  695753 - Cannot view traits for any resource on monitoring tab]

    This occured only for non-permissioned users.  There were two problems
    with the authz token handling.  First, the authz fragment needed to be be
    overriden (in SLSB) as the "resource" entity must be accessed through
    the "schedule" entity on MeasurementData.  Second, we should not be using
    the GROUP authz token type regardless of the criteria, because MeasurementData
    is at the resource level only. Meaning, we are not querying for "group-level"
    data regardless of whether we are filtering on the group embership for the
    target resource.

related:

commit bd77733861fa91606fe82516eea63972fb19f18f
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Tue Apr 19 12:45:04 2011 -0400

    related to [BZ 697098]
    Monitoring->Traits for a compat group was showing traits for explicit
    and implicit members.  Restrict to explicit.

Test Notes:
Perm and non-perm users. Ensure that only explicit members that the user has 
access to are included.  For the non-perm group view ensure that there exist some resources of the compat group type that are not in a group assigned to the user and that those inaccessible resources are excluded.
Comment 6 Mike Foley 2011-05-02 16:19:47 EDT
documenting that this is *not in rhq 4.0 Release.  only in master.  retest in master.
Comment 7 Mike Foley 2011-05-03 13:46:13 EDT
i see correct behavior on for monitoring traits on a build created from master (ie, not the 4.0 community release).
Comment 8 Corey Welton 2011-05-23 21:15:35 EDT
Bookkeeping - closing bug - fixed in recent release.
Comment 9 Corey Welton 2011-05-23 21:15:35 EDT
Bookkeeping - closing bug - fixed in recent release.
Comment 10 Corey Welton 2011-05-23 21:15:36 EDT
Bookkeeping - closing bug - fixed in recent release.
Comment 11 Corey Welton 2011-05-23 21:15:43 EDT
Bookkeeping - closing bug - fixed in recent release.

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