Bug 536393 - (RHQ-747) ClassCastException when defining GroupDefinition
ClassCastException when defining GroupDefinition
Status: CLOSED NEXTRELEASE
Product: RHQ Project
Classification: Other
Component: Configuration (Show other bugs)
1.1pre
All All
medium Severity medium (vote)
: ---
: ---
Assigned To: Joseph Marques
Jeff Weiss
http://jira.rhq-project.org/browse/RH...
: SubBug
Depends On:
Blocks: RHQ-399
  Show dependency treegraph
 
Reported: 2008-08-21 11:10 EDT by Van Halbert
Modified: 2014-11-09 17:50 EST (History)
1 user (show)

See Also:
Fixed In Version: 1.1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Windows Server
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 Van Halbert 2008-08-21 11:10:00 EDT
Defining in the DynaGroup Expression builder:
Resource = Resource
ExpressionType = Resource
Definiing Plugin = MetaMatrixPlugin
ResourceType = MetaMatrix Process
PropertyNames = id
Comparison Type = '='
resource.id.startsWith = MetaMatrix System

Select Calculate groups and the message displays:  There was a problem calculating the results: java.lang.ClassCastException: java.lang.String

In the server log, the following stack trace:

2008-08-21 09:25:41,557 INFO  [org.hibernate.type.IntegerType] could not bind value 'MetaMatrix System%' to parameter: 1; java.lang.String

2008-08-21 09:25:41,557 ERROR [org.rhq.enterprise.gui.definition.group.EditGroupDefinitionGeneralPropertiesUIBean] There was a problem calculating the results: 
javax.ejb.EJBException: java.lang.ClassCastException: java.lang.String
	at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214)
	at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184)
	at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
	at $Proxy245.calculateGroupMembership(Unknown Source)
	at org.rhq.enterprise.gui.definition.group.EditGroupDefinitionGeneralPropertiesUIBean.createGroups(EditGroupDefinitionGeneralPropertiesUIBean.java:156)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Comment 1 Charles Crouch 2008-08-21 16:57:22 EDT
I don't know if this is it but 
"Definiing Plugin = MetaMatrixPlugin" doesnt look right, try

"Defining Plugin = MetaMatrixPlugin"
Comment 2 Joseph Marques 2008-08-28 00:58:12 EDT
van, i notice that the expression builder created an expression of "resource.id.startsWith = MetaMatrix System"

however, resource.id as an integer field, and you're trying to compare it to a non-integer value of "MetaMatrix System".  

you should notice that when you choose "Resource" as the expression type, that the defining plugin and resource type are grayed out.  that's because they aren't relevant for that particular expression type.

id is an integer type and so only the '=' operation is valid.  startswith, endswith, and contains are string methods that will only match on string expressions.  i'm accepting this, but only as a way to track the need to display a better error message instead of blowing up with a stack trace.
Comment 3 Joseph Marques 2008-08-28 01:19:19 EDT
rev1303 - show a much more specific and relevant error when fields are compared to values of incompatible type, or when string functions are used on non-string fields; 
Comment 4 Jeff Weiss 2008-09-09 15:31:27 EDT
rev1385, i tried the expression:

resource.id.startsWith = MetaMatrix System

and when i clicked "Calculate Groups", i got an errorblock

"Probable syntax error: this is likely due to comparing an integer property of resource (such as id) to a non-numeric, or using a string function (startswith, endswith, or contains) on an integer property"

which is more than sufficient to tell the user what they did wrong.
Comment 5 Red Hat Bugzilla 2009-11-10 16:16:08 EST
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-747

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