Adding .package files to a KnowledgePackage
by Paul Ryan
So drools will respect files with a .package extension as a place for declared types, functions, etc. when used with these in the class path. How can a import these into a KnowledgePackage/KnowledgeBase so they can get compiled along with stuff when this is not in the class path at startup? My use case is such that these are not in the same space and can't be loaded at startup time in most cases.
Any help is greatly appreciated,
-- Paul Ryan
13 years, 10 months
Changing the java compiler level in drools
by balaji.govindarajulu
I want to change the java compiler level to 1.6 but it doesn't seem to work
for me. I am trying to use generics in the consequence part.
Following is my code that I used to change the compiler level.
*Drools Version: 5.2.1 GA
JDK Version : 1.6*
*final Properties properties = new Properties();
properties.setProperty("drools.dialect.java.compiler", "JANINO");
properties.setProperty("drools.dialect.default", "java");
properties.setProperty("drools.compiler.lnglevel", "1.6");
PackageBuilderConfiguration packageBuilderConfiguration =
new PackageBuilderConfiguration(properties,(ClassLoader[]) null);
final KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder(packageBuilderConfiguration);*
Let me know where I am going wrong.
Thanks for the help.
--
View this message in context: http://drools.46999.n3.nabble.com/Changing-the-java-compiler-level-in-dro...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 10 months
Cutom Attributes in Drools
by dme1
Hi,
Is there support for Custom Attributes in Drools? What I want to do is add
attributes which determines when rules should be fired as well as attributes
that the rule updates which I can query at a later time.
E.g. Fire rule only for specific regions. So when new rules are
created/added BAs can define if it is applicable to specific regions.
Then the rule could result in a violation that could or could not be
overriden, so I want to add an attribute called override which is set by the
rule, which I can check after all rules are fired. I can use MetaData to
define this, but I need a pre-defined list which BAs can choose from when
creating a new rule.
Any thoughts on how I can implement this would be appreciated.
Thanks,
dme
--
View this message in context: http://drools.46999.n3.nabble.com/Cutom-Attributes-in-Drools-tp4019692.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 10 months
Re: [rules-users] Data Model Dependencies in Guvnor
by Stephen Masters
I think this is the only option:
Upload the model into the global area, then within each package, you can create a new model and instead of uploading you can "Import from Global".
Although this is duplication rather than dependency, and you need to copy into each of your packages every time the model is updated. :-/
There is a Jira based on a similar request, but it has been unresolved for a good while:
https://issues.jboss.org/browse/GUVNOR-1401
Steve
> On 14 Sep 2012, at 14:54, dme1 <mehtad(a)hotmail.com> wrote:
>
>> Thanks Stephen for the detailed explanation. I agree that its not a good
>> option to add the dependency to the Server lib, and I also do not want to
>> mix up facts between my Java project and Drools, for various reasons.
>>
>> One other related question though, is there a way in Guvnor to specify
>> dependency amongst packages, i.e. can I say that the Extended Package
>> depends on the Common Package and it able to view the Model and all other
>> artifacts from Common. I did not see a way to do this, but want to check if
>> there is any way this can be achieved, which can help with a number of
>> things including Overrides etc. (when implemented)
>>
>> Thanks,
>> dme
>>
>>
>>
>> --
>> View this message in context: http://drools.46999.n3.nabble.com/Data-Model-Dependencies-in-Guvnor-tp401...
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
13 years, 10 months
Data Model Dependencies in Guvnor
by dme1
Hi,
I have created 2 projects in Eclipse - the first one is the Base Project
with the Model defined for this as BaseModel.jar. The send one is the
Extension Project which inherits the BaseModel and extends it, this Model is
called ExtendedModel.jar.
In Eclipse I can set the dependency on BaseModel in the Extended Project and
can write rules using the Base and Extended Models.
Now I create 2 packages in Guvnor one to represent the Base Project, the
second to represent the Extended Project. I upload the BaseModel to the
BaseProject and the associated technical rules and this all works well.
In the Extended Package I upload the "BaseModel.jar" successfully, however
when I try to upload the "ExtendedModel.jar" it gives me an Error. The only
way I can resolve my error is to update the ExtendedModel.jar to include all
classes from BaseModel.jar, so it seems like the Guvnor requires all
dependencies to be resolved within the Model jar and cannot reference other
Data Models within the same package.
Is there a way for Guvnor to lookup the other Models for dependencies and
resolve the dependencies? If not what is the recommended approach for
specifying dependent models in Guvnor?
Thanks,
dme
--
View this message in context: http://drools.46999.n3.nabble.com/Data-Model-Dependencies-in-Guvnor-tp401...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 10 months
problem with pesisted stateful knowledge session and Length Sliding Window
by henrychen
Hi all,
I am facing a problem with persisted stateful knowledge
session, please help me. My rule is listed as below:
package com.sample
import com.sample.Event;
import java.util.List;
declare Event
@role(event)
end
rule "test"
when
$list : List() from collect(Event() over window:
length(2))
then
System.out.println("----print out in rule, size of
the list collected from window is:" + $list.size());
end
The problem is,
when use a normal stateful session(created by the calling
kbase.newStatefulKnowledgeSession()), *when a third fact inserted, the
session working memory only retains list of 2, as expected.*
when use a persisted stateful session(created by the calling
JPAKnowledgeService.newStatefulKnowledgeSession()), insert 2 facts first.
Then restore this session by
JPAKnowledgeService.loadStatefulKnowledgeSession(), and *insert a third
fact, the session working memory grows to list of 3?*
By the way, I am using version 5.2.0.Final. And after I upgrade
to version 5.4.0.Final, the test result of persisted session becomes to
normal.*The attachment is my test program and you can repeat it.*
I want to ask you if there is something missing that I need to
do in 5.2.0.Final?
Thank you in advance, any help will be appreciated.
http://drools.46999.n3.nabble.com/file/n4019766/drools-session-persis-dem...
drools-session-persis-demo.zip
--
View this message in context: http://drools.46999.n3.nabble.com/problem-with-pesisted-stateful-knowledg...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 10 months
exception jitting problem
by brendanneff
Hello,
I recently "inherited" drools management of our system when the previous
code owner left the company unexpectedly, and sure enough, as soon as he
left, I found the errors posted below. Being new to drools, I'm pretty lost
about how to begin troubleshooting this issue.
I read a few forum posts about updating to 5.4 CR1 (we're using 5.4 Final),
but wanted to ask and see if that's really the cause before I start changing
the version. I also saw that casting as an Integer, which we do, could
solve the problem. Could someone take a look at this and let me know if
changing to CR1 would fix the issue or if there's a simpler solution?
A little more info:
We recently started increasing our traffic, which may be why we didn't see
this issue before.
I can't tell if this happens every 21st call or not, as was noted in other
forum posts. We have multiple rules in each .drl file, and it seems like
only these two rules are referenced, and none of the others. All rules in
the file are called, so shouldn't the others cause the exceptions too?
As far as I can tell, we're passing valid values each time to the rules.
If there's any other information I can provide, please let me know.
Thanks
Exception in thread "Thread-69" java.lang.RuntimeException: Exception
jitting: !getActiveLender($loan.getCurrentLender().getName()).canMakeLoan
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)
at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
at
org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.VerifyError: (class:
ConditionEvaluator30c1aafd8a5c4402813396a1ab9f4739, method: evaluate
signature:
(Ljava/lang/Object;Lorg/drools/common/InternalWorkingMemory;Lorg/drools/reteoo/LeftTuple;)Z)
Expecting to find integer on stack
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
at java.lang.Class.getConstructor0(Class.java:2714)
at java.lang.Class.getConstructor(Class.java:1674)
at
org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)
... 5 more
Exception in thread "Thread-70" java.lang.RuntimeException: Exception
jitting: new Integer(getCustomer().getLatestEmployer().monthlySalary) < 1251
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)
at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
at
org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.VerifyError: (class:
ConditionEvaluatorcc9abc72a67b4dd2bbde979a1a2baa48, method: evaluate
signature:
(Ljava/lang/Object;Lorg/drools/common/InternalWorkingMemory;Lorg/drools/reteoo/LeftTuple;)Z)
Expecting to find integer on stack
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
at java.lang.Class.getConstructor0(Class.java:2714)
at java.lang.Class.getConstructor(Class.java:1674)
at
org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)
... 5 more
Here are the rules that seem to be causing the errors:
rule "Cashcure - Average Monthly Income Less Than 1251"
when
$loan : CMVNewLoanBean( new
Integer(getCustomer().getLatestEmployer().monthlySalary) < 1251)
then
$loan.setLenderError($loan.getCurrentLender().getName(), 20253);
end
rule "Cashcure - Loan Cap Has Been Reached"
when
$loan : CMVNewLoanBean(
!getActiveLender($loan.getCurrentLender().getName()).canMakeLoan )
then
$loan.setLenderError($loan.getCurrentLender().getName(), 20259);
end
--
View this message in context: http://drools.46999.n3.nabble.com/exception-jitting-problem-tp4019764.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 10 months