Edson Tirelli | 2 Dec 19:06

Re: ClassCastException when firing rules


   Yes, that is correct. If the underlying class interface changed, java will raise CCE. Rulebase must be recompiled in that case.

   []s
   Edson

2008/12/2 seemamani <seemamani <at> gmail.com>

Thanks Dean, we have removed the AOP implementation to check if that is the
source of the problem.

Edson, Is there any chance for a ClassCastException if the fact classes in
the application were changed, but the fact model classes that are part of
the compiled rule package were not updated to the most recent version? But
then it would cause exceptions consistently, right? In our case, the
exceptions are thrown occasionally only.

Thanks,
Seema


Dean Turner wrote:
>
> FYI: Spring AOP enhances objects via CGLIB when no interface is available.
> If an interface is avaiable, it uses an jdk dynamic proxy.
>
> -----Original Message-----
> From: rules-users-bounces <at> lists.jboss.org
> [mailto:rules-users-bounces <at> lists.jboss.org] On Behalf Of seemamani
> Sent: Wednesday, November 26, 2008 11:18 AM
> To: rules-users <at> lists.jboss.org
> Subject: Re: [rules-users] ClassCastException when firing rules
>
>
> Edson,
>
> We are not sure how the CGLIB proxy is getting created. We were under the
> impression that it is the shadow fact proxy generated by Drools itself. I
> would like to share a few more points about our application in case they
> are
> somehow related to this problem.
>
> 1. We are using Spring AOP for intercepting method calls and passing the
> facts, globals etc to a class that invoke Drools. Version of Spring is
> 2.0.7
> 2. We are using Hibernate 3.x/JPA for persistence. In fact the Inventory
> POJO that is causing the ClassCastException is a JPA entity
> 3. We have rules defined in multiple packages. The Inventory POJO is used
> by
> rules in all the packages. But the exception is occurring only for rules
> in
> a particular package. That too only occasionally.
>
> Please let me know if any other information is required.
>
> Thanks,
> Seema
>
>
> Edson Tirelli-3 wrote:
>>
>>    What are you guys doing with CGLIB? or is this WebSphere doing some
>> sneaky thing behind the scenes? Or is it SpringAOP doing sneaky things?
>>
>> Caused by:
>> java.lang.ClassCastException: com.adesa.data.grounding.pojo.Inventory
>> incompatible with
>> com.adesa.data.grounding.pojo.Inventory$$EnhancerByCGLIB$$de81aab3
>>
>>    At compile time we determine that "inventory" is a
>> com.adesa.data.grounding.pojo.Inventory. If at runtime what arrives into
>> the
>> expression is a
>> com.adesa.data.grounding.pojo.Inventory$$EnhancerByCGLIB$$de81aab3,
>> and it is not a proper subclass, you might get such problems.
>>
>>    Having said that, I will talk to Mike to check if this can be
> prevented
>> somehow, but I really don't know if it will be possible...
>>
>>    []s
>>    Edson
>>
>>
>>
>> 2008/11/25 seemamani <seemamani <at> gmail.com>
>>
>>>
>>> hi,
>>>
>>> We are using Drools 4.0.7 in a web application deployed in WebSphere
> 6.1.
>>> Occasionally, we have rule engine failure caused by
>>> RuntimeDroolsException
>>> (whose root cause is shown as ClassCastException) when firing rules.
>>> Other
>>> times, the rules are executing without errors. Here is the stack trace
> of
>>> the exception. What are the possible reasons?
>>>
>>> Thanks,
>>> Seema
>>>
>>> org.drools.RuntimeDroolsException: Exception executing predicate eval(
>>> inventory.leaseInformation != null )
>>>        at
>>>
> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216
> )
>>>        at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
>>>        at
>>>
>>>
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(Composi
> teObjectSinkAdapter.java:318)
>>>        at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
>>>        at
>>>
>>>
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(Composi
> teObjectSinkAdapter.java:318)
>>>        at
>>> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
>>>        at org.drools.reteoo.Rete.assertObject(Rete.java:175)
>>>        at
>>> org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
>>>        at
>>>
> org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71
> )
>>>        at
>>>
>>>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:
> 911)
>>>        at
>>>
>>>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:
> 883)
>>>        at
>>>
>>>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:
> 684)
>>>        at
>>>
>>>
> com.adesa.business.framework.rules.process.drools.ManagedStatefulSession.i
> nit(ManagedStatefulSession.java:87)
>>>        at
>>>
>>>
> com.adesa.business.framework.rules.process.drools.ManagedStatefulSession.f
> ireAllRules(ManagedStatefulSession.java:100)
>>>        at
>>>
>>>
> com.adesa.business.framework.rules.process.drools.RuleEngineImpl.execute(R
> uleEngineImpl.java:60)
>>>        at
>>>
>>>
> com.adesa.business.framework.rules.interceptor.RulesInterceptor.applyAnnot
> edRules(RulesInterceptor.java:109)
>>>        at
>>>
>>>
> com.adesa.business.framework.rules.interceptor.RulesInterceptor.applyRules
> (RulesInterceptor.java:80)
>>>        at sun.reflect.GeneratedMethodAccessor575.invoke(Unknown Source)
>>>        at
>>>
>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl.java:43)
>>>        at java.lang.reflect.Method.invoke(Method.java:618)
>>>        at
>>>
>>
>>>
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWi
> thGivenArgs(AbstractAspectJAdvice.java:597)
>>>        at
>>>
>>>
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(A
> bstractAspectJAdvice.java:583)
>>>        at
>>>
>>>
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAd
> vice.java:60)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>>        at
>>>
>>>
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(Exp
> oseInvocationInterceptor.java:89)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>>        at
>>>
>>>
> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor
> .intercept(Cglib2AopProxy.java:629)
>>>        at
>>>
>>>
> com.adesa.business.rules.RuleHandler$$EnhancerByCGLIB$$3ab6eda.fireUpdateP
> ricing(<generated>)
>>>        at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.updatePricing(Sale
> EventManagerImpl.java:2599)
>>>        at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfAuct
> ion(SaleEventManagerImpl.java:1993)
>>>        at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGrou
> ndingSaleEventForHyundai(SaleEventManagerImpl.java:1783)
>>>        at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGrou
> ndingSaleEvent(SaleEventManagerImpl.java:1180)
>>>        at
>>>
>>>
> com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGrou
> ndingSaleEvent(SaleEventManagerImpl.java:1134)
>>>        at
>>>
>>>
> com.adesa.business.auction.service.AuctionServiceImpl.cascadeAtEndOfGround
> ingSaleEvent(AuctionServiceImpl.java:766)
>>>        at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
>>>        at
>>>
>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl.java:43)
>>>        at java.lang.reflect.Method.invoke(Method.java:618)
>>>        at
>>>
>>>
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Ao
> pUtils.java:304)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoi
> nt(ReflectiveMethodInvocation.java:182)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:149)
>>>        at
>>>
>>>
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(
> TransactionInterceptor.java:106)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>>        at
>>>
>>>
> org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.procee
> d(MethodInvocationProceedingJoinPoint.java:77)
>>>        at
>>>
>>>
> com.adesa.business.framework.logging.LoggingInterceptor.profileLog(Logging
> Interceptor.java:136)
>>>        at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
>>>        at
>>>
>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl.java:43)
>>>        at java.lang.reflect.Method.invoke(Method.java:618)
>>>        at
>>>
>>>
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWi
> thGivenArgs(AbstractAspectJAdvice.java:597)
>>>        at
>>>
>>>
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(A
> bstractAspectJAdvice.java:583)
>>>        at
>>>
>>>
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAd
> vice.java:60)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>>        at
>>>
>>>
> org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.
> invoke(AfterReturningAdviceInterceptor.java:50)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>>        at
>>>
>>>
> org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJA
> fterThrowingAdvice.java:54)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>>        at
>>>
>>>
> org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.in
> voke(MethodBeforeAdviceInterceptor.java:50)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>>        at
>>>
>>>
> org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJA
> fterThrowingAdvice.java:54)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>>        at
>>>
>>>
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(Exp
> oseInvocationInterceptor.java:89)
>>>        at
>>>
>>>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:171)
>>>        at
>>>
>>>
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopP
> roxy.java:204)
>>>        at $Proxy58.cascadeAtEndOfGroundingSaleEvent(Unknown Source)
>>>        at
>>>
>>>
> com.adesa.business.pricing.ejb.PricingBean.updateMBPPrice(PricingBean.java
> :112)
>>>        at
>>>
>>>
> com.adesa.business.pricing.ejb.EJSRemoteStatelessPricing_a0966b04.updateMB
> PPrice(EJSRemoteStatelessPricing_a0966b04.java:183)
>>>        at
>>>
>>>
> com.adesa.business.pricing.ejb._EJSRemoteStatelessPricing_a0966b04_Tie.upd
> ateMBPPrice(_EJSRemoteStatelessPricing_a0966b04_Tie.java:243)
>>>        at
>>>
>>>
> com.adesa.business.pricing.ejb._EJSRemoteStatelessPricing_a0966b04_Tie._in
> voke(_EJSRemoteStatelessPricing_a0966b04_Tie.java:108)
>>>        at
>>>
>>>
> com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.jav
> a:621)
>>>        at
>>> com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:474)
>>>        at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
>>>        at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
>>>        at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2701)
>>>        at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2575)
>>>        at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
>>>        at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
>>>        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
>>> Caused by:
>>> java.lang.ClassCastException: com.adesa.data.grounding.pojo.Inventory
>>> incompatible with
>>> com.adesa.data.grounding.pojo.Inventory$$EnhancerByCGLIB$$de81aab3
>>>        at ASMAccessorImpl_11448003161226563261710.getValue(Unknown
>>> Source)
>>>        at
>>>
>>>
> org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableD
> eepPropertyNode.java:22)
>>>        at
>>>
>>>
> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.ja
> va:21)
>>>        at
>>>
>>>
> org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.ja
> va:21)
>>>        at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
>>>        at
>>> org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
>>>        at org.mvel.MVEL.executeExpression(MVEL.java:235)
>>>        at
>>>
>>>
> org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpress
> ion.java:45)
>>>        at
>>>
> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:209
> )
>>> --
>>> View this message in context:
>>>
> http://www.nabble.com/ClassCastException-when-firing-rules-tp20694738p2069
> 4738.html
>>> Sent from the drools - user mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> 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 <at> www.jboss.com
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users <at> lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Occasional-ClassCastException-when-firing-rules-tp20
> 694738p20705144.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users <at> lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> _______________________________________________
> rules-users mailing list
> rules-users <at> lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>

--
View this message in context: http://www.nabble.com/Occasional-ClassCastException-when-firing-rules-tp20694738p20794410.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
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 <at> www.jboss.com
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Trägenap | 2 Dec 07:47

german manual available?

Hi,

is a drools documentation (especiall about the language definition part) in german language available?

I found some articles (it just was a interview with a team developer), which are reporting about german docs, but I can´t find any link to it.

Thanks a lot

Thorsten

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Vithal Kuchibhotla | 2 Dec 06:26
Favicon

Re :Action firing twice

Reformatted as plain text:

Hello All,

I have a list of Items that I am inserting into working memory. Here is the rule that is failing:

rule "Cannot select X if both Y and Z are not selected"
when
      Item(code == "X")   
     (or (not Item(code == "Y"))
           (not Item(code == "Z")))
then
    System.out.println("Error: You cannot select X unless both Y and Z are selected");
end

This rule works correctly when X and Y are there, and when X and Z are there.
However, when both Y and Z are missing, the error prints twice.
Can anyone tell me what I am doing wrong.

Thanks a lot
Vithal



_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Vithal Kuchibhotla | 2 Dec 06:17
Favicon

Action firing twice

Hello All,

I have a list of Items that I am inserting into working memory. Here is the rule that is failing:

rule "Cannot select X if both Y and Z are not selected"
when
    Item(code == "X")
    (or (not Item(code == "Y"))
        (not Item(code == "Z")))
then
    System.out.println("Error: You cannot select X unless both Y and Z are selected");
end

This rule works correctly when X and Y are there, and when X and Z are there. However, when both Y and Z are missing, the error prints twice. Can anyone tell me what I am doing wrong.

Thanks a lot
Vithal

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
vanshi | 2 Dec 06:05

Inline eval problem!


I need to convert a variable from string to intger in the rule. That variable
here is rank, so, I create a helper class called 'Conversion' with just one
function/method, which is supposed to convert the string argument passed to
it, to an integer and then I call that method in rule as inline eval. What's
wrong here because this is not working and I don't want to change 'When'
part too much because it has 10 or so other variable with && connective,
which I've removed for clarity here. Any input would be appreciated much.

package harules;
import com.hibernate.Person;
import com.uhg.utils.Conversion;

rule "one"
salience 10
	when
	$con: Conversion();
	pers: Person(age!= null , age >= 18 , eval($con.getInteger(rank) > 140))
	then
	System.out.println("Evaluated true");
end

//content of Conversion class
package com.utils;
public class Conversion {
public Integer getInteger(String s)
{
	return Integer.parseInt(s);
}
}
--

-- 
View this message in context: http://www.nabble.com/Inline-eval-problem%21-tp20786253p20786253.html
Sent from the drools - user mailing list archive at Nabble.com.

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

Edson Tirelli | 1 Dec 22:51

Re: function problem


   If I understood the problem, one way would be (assuming $tags is a global list):

when
    Person( ageInYears >= 18, $tagList : tagList )
    exists( String( this memberof $tags ) from $tagList )
then
   ...
end

   If $tags is a fact, just bind it before the "exists".

   []s
   Edson


2008/12/1 Dan Seaver <dan.seaver <at> ge.com>

Charlie,
I'm not sure why your function doesn't compile as it looks fine to me. Do
you have any other details about the message you're getting from the
compiler?

In any case, you may want to consider solving the problem a different way.
In general, you should try to avoid "eval" statements whenever possible as
they can severely hamper performance. Edson wrote up some helpful hints -
see "Eval is Evil" at -
http://blog.athico.com/2007/03/writing-better-rules.html

As an alternative, try populating working memory with each of the Person's
tagList items and then use "memberOf" to determine if it's one of the
engineering TagCodes. (You may be able to use the "from" statement with the
Person's tagList instead of populating working memory) This allows Drools to
do all of the work for you and may very well be faster than using loops.

Let me know if you need further clarification.


Charlie Holland wrote:
>
> I'm fairly new to Drools so there may be an easier way to do this. I need
> to
> check to see if any one of a list of tags on an object are in another list
> of tags and am trying to do that with a function. the compiler tells me it
> can't compile my eval function:
>
> #list any import classes here.
> **
>
> *import* com.cp.services.rules.sources.Person;
> **
>
> *import* com.cp.services.rules.actions.PersonActions;
> **
>
> *import* com.cp.rules.TagCodes;
> **
>
> *import* java.util.List;
>
>
>
> #declare any global variables here
> **
>
> *global* com.cp.services.rules.actions.PersonActions personActions;
>
> **
>
> *function* *boolean* hasOneOf(List list1, String[] list2){
>
> *for* (Object obj : list1) {
>
> String string = (String)obj;
>
> *for* (*int* j = 0; j < list2.length; j++) {
>
> *if* (string != *null* && string.equals(list2[j])) {
>
> *return* *true*;
>
> }
>
> }
>
> }
>
> *return* *false*;
>
> }
>
> **
>
> *rule* "Engineering"
>
> *dialect* "mvel"
>
> *when*
> **
>
> #conditions
>
> Person( ageInYears >= 18 ) *and*
>
> *eval* ( hasOneOf(Person(tagList), TagCodes(engrTags)) )
>
> *then*
>
> #actions
>
> personActions.addAction("EngineeringGroup");
>
> *
>
> end
> *
>
> _______________________________________________
> rules-users mailing list
> rules-users <at> lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>

--
View this message in context: http://www.nabble.com/function-problem-tp20633662p20774756.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
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 <at> www.jboss.com
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
keithnielsen | 1 Dec 17:46

Precompilation of Rule Flows


I have a number of questions as it relates the creation of rule flows:

1) I am assuming that when creating the constraints within a given node
within a rule flow that the selection of "rule"  as the type will create a
rule behind the scenes while selection of "code" will create some java
object representation? If this is a correct understanding is there any
preference from an engine perspective, are there performance or other
considerations that must be taken into account?

2) Is there any way to precompile rule flows like rule files are (as opposed
to at runtime with a call to packageBuilder.addRuleFlow(source))? With the
Drools builder any errors in the .drl files are highlighted. Not so with the
.rf. In order to see what is generated it appears that you have to step
through in debug mode at runtime and buried inside there is a string
representation of everything that was generated as well a list of errors
which refer to errors such as parse errors. Unfortunately this manifests
itself eventually (at least with my flow) as a NullPointerException giving
absolutely no indication as to the root of the problems, which I am assuming
are these parser errors. Seems to me that these errors should be returned
with a call to packageBuilder.hasErrors() which is empty in my case.
3) Code assist doesnt appear to work in action editor or constraint editor
which is I think is a pretty big usablity issue. Anything planned to make
this available?

Thanks
--

-- 
View this message in context: http://www.nabble.com/Precompilation-of-Rule-Flows-tp20774511p20774511.html
Sent from the drools - user mailing list archive at Nabble.com.

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

Thierry B | 1 Dec 12:25

Re: expand rules with dsl

> Hi,
>
> You can do both ways:
> 1)
> in DSL:
> There is a Message that=msg : Message(payload : payload)
> in DSLR:
> There is a Message that
> xpathEquals "/Root/aaaa" "bbb"
> xpathEquals "/Root/cccc" "dddd"
>
> 2)
> in DSL:
> xpathEquals "{path}" "{value}"=msg : Message(payload : payload) and eval
> (DOMUtil.xpathEquals(payload, "{path}", "{value}"))
> andXpathEquals "{path}" "{value}"=eval (DOMUtil.xpathEquals(payload,
> "{path}", "{value}"))
> in DSLR:
> xpathEquals "/Root/aaaa" "bbb"
> andXpathEquals "/Root/cccc" "dddd"

Ok, Thanks :-)

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

Thierry B | 1 Dec 09:53

expand rules with dsl

Hello,

I've a question about drl and dsl with drools 4.0.

I've this rule :

rule "Contexte1"
	when
	   msg : Message(payload : payload)
	   eval (DOMUtil.xpathEquals(payload, "/Root/aaaa", "bbb"))
	   eval (DOMUtil.xpathEquals(payload, "/Root/cccc", "dddd"))
	then
           System.out.println ("Contexte 1 ************* : OK");
end

I use a dsl, to make it work, so now my drl is like that :

rule "Contexte1"
	when
		>msg : Message(payload : payload)
		xpathEquals "/Root/aaaa" "bbb"
		xpathEquals "/Root/cccc" "dddd"
	then
		Log : "Contexte 1 ************* : OK";
end

I was forced to make an ">" at the line "msg : Message(payload : payload)"
otherwise, he tells me that he can't expand that line.

There is a way to :
- avoid to put the ">" even if I have to add something else to the dsl ?
- avoid the line "msg : Message(payload : payload)" in my drl and simplify
my dsl so that xPathEquals "know" that the "payload" variable come from
any object Message in Working Memory ?

Thanks :-)

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

Shigeaki Wakizaka | 1 Dec 05:24

recommend way about same when , different then

Hi. I'm newbie to Drools.

I'm just wondering how I define the rules with my web application that has
several layers, web,business-logic,and data access.
one rule is used in the wab layer, and another one is used in the
business-logic layer.
Both rule's "when" are the same, but the "then"(action) is different.

It looks like code dupulication.
(I mean when the "when" changes, every rules that has same "when" has to be
changed, right?)

What's the recommended way in this situation?

thanks

Shige

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

Waleed Zedan | 1 Dec 04:53

Re: Oring conditions

Hi ,

Thanks for your quick reply,

the problem that these conditions are on different objects for example

Person(name == "xyz") &&
(Cheese(type == "zzz") OR
 Address(street == "1") OR
 Phone (number == "xyz") )

Thanks again.

Best Regards,

Waleed Zedan

On Sun, Nov 30, 2008 at 7:03 PM, Edson Tirelli <tirelli <at> post.com> wrote:
 
   Are conditions 2-4 applied to the same pattern type? If so, you can use the "||" Field Constraint Connective instead of the "or" Conditional Element:

when
    Person( name  == "Bob" )
    Cheese( type == "brie" || size > 2 || price <= 30 )
then
   ...
end

    These conditions will not generate new rules as the OR CE does...

    []s
    Edson


2008/11/30 Waleed Zedan <wzedan <at> gmail.com>
Hi All,

I have this requirment : Rule A -> Condition 1 AND
                                                (Condition 2 OR
                                                 Condition 3 OR
                                                 Condition 4)
The problem is that OR (||) operators in drools are not a short circuiting operators like in Java.

May you please tell me an approach to handle this situation , i have already tried splitting it on multiple rules ,but i am searching for better approach.

I am using Drools 4.0.7.

Thanks.

Best Regards,

--
Waleed Zedan



_______________________________________________
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 <at> www.jboss.com

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




--
Waleed Zedan
Senior Software Developer
IT Design & Development Department
Dubai Customs

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

Gmane