Bug 536393 (RHQ-747) - ClassCastException when defining GroupDefinition
Summary: ClassCastException when defining GroupDefinition
Keywords:
Status: CLOSED NEXTRELEASE
Alias: RHQ-747
Product: RHQ Project
Classification: Other
Component: Configuration
Version: 1.1pre
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: ---
Assignee: Joseph Marques
QA Contact: Jeff Weiss
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard:
Depends On:
Blocks: RHQ-399
TreeView+ depends on / blocked
 
Reported: 2008-08-21 15:10 UTC by Van Halbert
Modified: 2014-11-09 22:50 UTC (History)
1 user (show)

Fixed In Version: 1.1
Clone Of:
Environment:
Windows Server
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Van Halbert 2008-08-21 15:10:00 UTC
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 20:57:22 UTC
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 04:58:12 UTC
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 05:19:19 UTC
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 19:31:27 UTC
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 21:16:08 UTC
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.