[rules-users] java.lang.ClassCastException: java.lang.String cannot be cast to com.sample.DroolsTest$Message

2012-01-18 Thread Veera
Hi All,

Can anybody tell me what is the problem here ..
i have a 2 classes:
 person(i have a field in this :java.lang.String
add) 
 Message(i have a filed in this :java.lang.String
name)
rule H
when
  person( $a : add )
  Message ( name == tree ) from $a 

then
# System.out.println(in H rule);

when i compile this rule i am getting below exception...

java.lang.ClassCastException: java.lang.String cannot be cast to
com.sample.DroolsTest$Message

Thanks in Advance
Veeras



--
View this message in context: 
http://drools.46999.n3.nabble.com/java-lang-ClassCastException-java-lang-String-cannot-be-cast-to-com-sample-DroolsTest-Message-tp3671568p3671568.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] java.lang.ClassCastException: java.lang.String cannot be cast to com.sample.DroolsTest$Message

2012-01-18 Thread Guruprasad Bhaskariah Bobbi

Try this..

$p : person( )
Message( name == tree ) from $p.add

-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Veera
Sent: Thursday, January 19, 2012 11:57 AM
To: rules-users@lists.jboss.org
Subject: [rules-users] java.lang.ClassCastException: java.lang.String cannot be 
cast to com.sample.DroolsTest$Message

Hi All,

Can anybody tell me what is the problem here ..
i have a 2 classes:
 person(i have a field in this :java.lang.String
add) 
 Message(i have a filed in this :java.lang.String
name)
rule H
when
  person( $a : add )
  Message ( name == tree ) from $a 

then
# System.out.println(in H rule);

when i compile this rule i am getting below exception...

java.lang.ClassCastException: java.lang.String cannot be cast to 
com.sample.DroolsTest$Message

Thanks in Advance
Veeras



--
View this message in context: 
http://drools.46999.n3.nabble.com/java-lang-ClassCastException-java-lang-String-cannot-be-cast-to-com-sample-DroolsTest-Message-tp3671568p3671568.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

 CAUTION - Disclaimer *
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not 
to copy, disclose, or distribute this e-mail or its contents to any other 
person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has 
taken 
every reasonable precaution to minimize this risk, but is not liable for any 
damage 
you may sustain as a result of any virus in this e-mail. You should carry out 
your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this 
e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS End of Disclaimer INFOSYS***

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] java.lang.ClassCastException: java.lang.String cannot be cast to com.sample.DroolsTest$Message

2012-01-18 Thread Wolfgang Laun
You cannot cast an object of type java.lang.String (i.e.
$a as it is bound to add) to Message.

Apparently you have not understood how from works.
(Its various forms are described in the Expert manual.)
Most frequently, it is used to pull one or more objects,
one at a time, from a fact, in order to permit them to
match a pattern although they have not been inserted
in Working Memory.

What I see in this rule doesn't indicate what you might
have intended to do - so I cannot propose an improved
version.

-W


On 19/01/2012, Veera veera...@gmail.com wrote:
 Hi All,

 Can anybody tell me what is the problem here ..
 i have a 2 classes:
  person(i have a field in this :java.lang.String
 add)
  Message(i have a filed in this :java.lang.String
 name)
 rule H
 when
   person( $a : add )
   Message ( name == tree ) from $a

 then
 # System.out.println(in H rule);

 when i compile this rule i am getting below exception...

 java.lang.ClassCastException: java.lang.String cannot be cast to
 com.sample.DroolsTest$Message

 Thanks in Advance
 Veeras



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/java-lang-ClassCastException-java-lang-String-cannot-be-cast-to-com-sample-DroolsTest-Message-tp3671568p3671568.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users