[rules-users] RE: rules-users Digest, Vol 29, Issue 59

Tom.E.Murphy at wellsfargo.com Tom.E.Murphy at wellsfargo.com
Tue Apr 21 08:45:48 EDT 2009


Thanks for the reply, Edson.

After several hours, I finally tracked down the source of the issue. In one of our rules, the following appeared as part of the LHS:

		$asset_count : Integer(intValue  > 3) from accumulate (
		Asset
		(
			// bunch of constraints....

		) count())

The use of Integer here instead of Number was the root cause of the thrown exception.

The reason it was so hard to find is because this expression was being evaluated (I'm guessing) to determine whether the rule should be activated. Thus, even though we were monitoring activation events as well as insertions, de-activations, firings, etc. we were never able to see which rule was causing the issue - it would throw before any related events fired. And even in the debugger, the rule that was causing the exception could not be identified, as it was not visible from the various nodes and other data structures that comprise the internals of Drools RETE. At least, not visible to me, a total newbie on the internals.

Admittedly, this does not match the syntax shown in the Drools manual (which illustrates it using Number instead of Integer), but it would have been a big time saver if the Drools parser could have rejected this as a syntax error or alerted us to the questionable usage in some way. In a rule base of several hundred complex rules, it was a nightmare to find. 

I don't know whether you still want a JIRA for this or not, since technically it resulted from a rules coding error - ??

Thanks again.

Tom Murphy
Business Process Consultant
Wells Fargo HCFG - CORE Deal Decisioning Platform
800 S. Jordan Creek Parkway | West Des Moines, IA 50266
MAC: X2301-01B
Office: 515 324 4853 | Mobile: 941 320 8014
This message may contain confidential and/or privileged information.  If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein.  If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message.  Thank you for your cooperation.

-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of rules-users-request at lists.jboss.org
Sent: Tuesday, April 21, 2009 2:57 AM
To: rules-users at lists.jboss.org
Subject: rules-users Digest, Vol 29, Issue 59

Send rules-users mailing list submissions to
	rules-users at lists.jboss.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
	rules-users-request at lists.jboss.org

You can reach the person managing the list at
	rules-users-owner at lists.jboss.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."


Today's Topics:

   1. Re: Question: Why is ClassFieldReader.getIntValue 	throwing
      in this scenario? (Edson Tirelli)
   2. Re: Drools 3.0.6 - Not able to execute more than one	rule -
      Stucked up (Vir)
   3. Drools 3.0.6 with OC4J (Vir)
   4. "==" operator does not work on float and double type (Zeke)


----------------------------------------------------------------------

Message: 1
Date: Mon, 20 Apr 2009 22:05:34 -0400
From: Edson Tirelli <tirelli at post.com>
Subject: Re: [rules-users] Question: Why is
	ClassFieldReader.getIntValue 	throwing in this scenario?
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<e6dd5ba30904201905t3cf1fe25td9b6a43b9224ba4c at mail.gmail.com>
Content-Type: text/plain; charset="windows-1252"

   Sounds like a bug... it should be casting to Number instead of Integer.
Can you open a JIRA with a test case or a way to reproduce the problem?

   Thanks,
       Edson

2009/4/20 <Tom.E.Murphy at wellsfargo.com>

>  The following block of code inside org.drools.base.ClassFieldReader is
> throwing an exception and I don?t quite understand why. Can anyone advise?
> Thanks in advance.
>
> *public* *int* getIntValue(InternalWorkingMemory workingMemory,
> *final* Object object) {
>         *return* *this*.reader.getIntValue( workingMemory,
> object );
>     }
>
> Object is of type Long, with value = 0, when the throw happens, and
> workingMemory is null (having been explicitly passed in as null by the
> method two layers up in the stack:
>
> *public* *boolean* isAllowed(*final* InternalReadAccessor readAccessor,
>                              *final* InternalFactHandle handle,
>                              *final* InternalWorkingMemory workingMemoiry,
>                              *final* ContextEntry context) {
> *return* *this*.evaluator.evaluate( *null*,
>                                         *this*.readAccessor,
>                                         handle.getObject(),
>                                         *this*.field );
>     }
>
>
> While sitting on the breakpoint in getIntValue, the live call stack is as
> follows:
>
> ClassFieldReader.getIntValue(InternalWorkingMemory, Object) line: 164
> ComparableEvaluatorsDefinition$IntegerGreaterEvaluator.evaluate(InternalWorkingMemory,
> InternalReadAccessor, Object, FieldValue) line: 1881
> LiteralRestriction.isAllowed(InternalReadAccessor, InternalFactHandle,
> InternalWorkingMemory, ContextEntry) line: 92
> LiteralConstraint.isAllowed(InternalFactHandle, InternalWorkingMemory,
> ContextEntry) line: 109
> AccumulateNode.evaluateResultConstraints(LeftTuple, PropagationContext,
> InternalWorkingMemory, AccumulateNode$AccumulateMemory,
> AccumulateNode$AccumulateContext) line: 498
> AccumulateNode.assertLeftTuple(LeftTuple, PropagationContext,
> InternalWorkingMemory) line: 197
> SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(PropagationContext,
> InternalWorkingMemory, LeftTuple) line: 117
> SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(LeftTuple, RightTuple,
> PropagationContext, InternalWorkingMemory, boolean) line: 28
> JoinNode.assertObject(InternalFactHandle, PropagationContext,
> InternalWorkingMemory) line: 175
> CompositeObjectSinkAdapter.doPropagateAssertObject(InternalFactHandle,
> PropagationContext, InternalWorkingMemory, ObjectSink) line: 366
> CompositeObjectSinkAdapter.propagateAssertObject(InternalFactHandle,
> PropagationContext, InternalWorkingMemory) line: 349
> AlphaNode.assertObject(InternalFactHandle, PropagationContext,
> InternalWorkingMemory) line: 147
> SingleObjectSinkAdapter.propagateAssertObject(InternalFactHandle,
> PropagationContext, InternalWorkingMemory) line: 42
> AlphaNode.assertObject(InternalFactHandle, PropagationContext,
> InternalWorkingMemory) line: 147
> SingleObjectSinkAdapter.propagateAssertObject(InternalFactHandle,
> PropagationContext, InternalWorkingMemory) line: 42
> AlphaNode.assertObject(InternalFactHandle, PropagationContext,
> InternalWorkingMemory) line: 147
> CompositeObjectSinkAdapter.doPropagateAssertObject(InternalFactHandle,
> PropagationContext, InternalWorkingMemory, ObjectSink) line: 366
> CompositeObjectSinkAdapter.propagateAssertObject(InternalFactHandle,
> PropagationContext, InternalWorkingMemory) line: 342
> ObjectTypeNode.assertObject(InternalFactHandle, PropagationContext,
> InternalWorkingMemory) line: 184
> EntryPointNode.assertObject(InternalFactHandle, PropagationContext,
> ObjectTypeConf, InternalWorkingMemory) line: 146
> ReteooStatefulSession(AbstractWorkingMemory).insert(InternalFactHandle,
> Object, Rule, Activation, ObjectTypeConf) line: 1066
> ReteooStatefulSession(AbstractWorkingMemory).insert(Object, boolean,
> boolean, Rule, Activation) line: 1022
> DefaultKnowledgeHelper.insert(Object, boolean) line: 103
> DefaultKnowledgeHelper.insert(Object) line: 97
> Rule_RS6601_3_2_0.consequence(KnowledgeHelper, TransactionDetail,
> FactHandle, Double, FactHandle, DealRiskCategoryEnum$Enum, FactHandle,
> ExitStrategyTypeEnum$Enum, FactHandle, Short, FactHandle, Short, FactHandle)
> line: 32
> Rule_RS6601_3_2_0ConsequenceInvoker.evaluate(KnowledgeHelper,
> WorkingMemory) line: 42
> DefaultAgenda.fireActivation(Activation) line: 934
> DefaultAgenda.fireNextItem(AgendaFilter) line: 885
> DefaultAgenda.fireAllRules(AgendaFilter, int) line: 1082
> ReteooStatefulSession(AbstractWorkingMemory).fireAllRules(AgendaFilter,
> int) line: 682
> ReteooStatefulSession(AbstractWorkingMemory).fireAllRules() line: 649
> StatefulKnowledgeSessionImpl.fireAllRules() line: 177
> RuleBase.runTestCase(LoanFile, String, int, Logger) line: 116
>
>
>
> *Tom Murphy
> **Business Process Consultant
> Wells Fargo HCFG - CORE Deal Decisioning Platform
> 800 S. Jordan Creek Parkway | West Des Moines, IA 50266
> MAC: **X2301-01B
> **Office: **515 324 4853** | Mobile: 941 320 8014
> **This message may contain confidential and/or privileged information.  If
> you are not the addressee or authorized to receive this for the addressee,
> you must not use, copy, disclose, or take any action based on this message
> or any information herein.  If you have received this message in error,
> please advise the sender immediately by reply e-mail and delete this
> message.  Thank you for your cooperation.*
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090420/0ab148d6/attachment-0001.html

------------------------------

Message: 2
Date: Mon, 20 Apr 2009 22:27:43 -0700 (PDT)
From: Vir <viral.raval at tcs.com>
Subject: Re: [rules-users] Drools 3.0.6 - Not able to execute more
	than one	rule - Stucked up
To: rules-users at lists.jboss.org
Message-ID: <23149402.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi All,

   Can someone please help me, I am stucked up.

Thanks,
Vir



Vir wrote:
> 
> Hi All,
> 
>    I am new to drools.  I am using Drools 3.0.6.  When I execute just one
> rule, it works fine.  But when I run the same file with 2 or more rules,
> at runtime in console the SOPs stops at 
> org.apache.commons.jci.compilers.JaninoJavaCompiler - compiling
> com.tcs.sgv.apps.requesthandler.services.Rule_Credit_Denied_0
> 
>   Same example works fine in Eclipse and both rules are executed, but my
> constraints are jDeveloper, jdk1.4, OC4J.  Can someone help me out
> 
> Following is my .java file code
> 
> PackageBuilder builder = new PackageBuilder();
> builder.addPackageFromDrl(new
> InputStreamReader(CreditExample.class.getResourceAsStream("/abc.drl")));
> RuleBase ruleBase = RuleBaseFactory.newRuleBase();
> ruleBase.addPackage(builder.getPackage());
> WorkingMemory workingMemory = ruleBase.newWorkingMemory();
> Person child = new Person("Person 1", 15);
> Person adult = new Person("Person 2", 25);
> workingMemory.assertObject(adult);
> workingMemory.assertObject(child);
> workingMemory.fireAllRules();
> 
> Following is my .drl file
> 
> rule "Credit Allowed"
> 	when
> 		person:Person(age >= 18)
> 	then
> 		System.out.println("Credit allowed for " + person.getName());
> end
> rule "Credit Denied"
> 	when
> 		deniedPerson:Person(age < 18)
> 	then
> 		System.out.println("Credit denied for " + deniedPerson.getAge());
> end
> 
> Thanks for any solution/replies
> Regards 
> Vir
> 

-- 
View this message in context: http://www.nabble.com/Drools-3.0.6---Not-able-to-execute-more-than-one-rule-tp23077434p23149402.html
Sent from the drools - user mailing list archive at Nabble.com.



------------------------------

Message: 3
Date: Tue, 21 Apr 2009 00:30:19 -0700 (PDT)
From: Vir <viral.raval at tcs.com>
Subject: [rules-users] Drools 3.0.6 with OC4J
To: rules-users at lists.jboss.org
Message-ID: <23150588.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi all,

    I am want to integrate Drools 3.0.6 with OC4J Server.  If I write more
than one rule in .drl file, it is not working.  A single rule works fine.  I
am using JDeveloper as IDE.

   Is it that I can't use drools with OC4J ?  Are there any configuration
changes required.

Thanks,
Vir
-- 
View this message in context: http://www.nabble.com/Drools-3.0.6-with-OC4J-tp23150588p23150588.html
Sent from the drools - user mailing list archive at Nabble.com.



------------------------------

Message: 4
Date: Tue, 21 Apr 2009 15:56:57 +0800
From: Zeke <xanadu860122 at gmail.com>
Subject: [rules-users] "==" operator does not work on float and double
	type
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<8bcb551d0904210056qe159b4ejd6717e819162b754 at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Skipped content of type multipart/alternative-------------- next part --------------
A non-text attachment was scrubbed...
Name: HelloWorldExample.java
Type: application/octet-stream
Size: 4417 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090421/e687f4c3/HelloWorldExample.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.drl
Type: application/octet-stream
Size: 242 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090421/e687f4c3/test.obj

------------------------------

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


End of rules-users Digest, Vol 29, Issue 59
*******************************************




More information about the rules-users mailing list