Unable to have KBase recognize our DRL files
by Mayank
Hi,
We are in the process of upgrading Drools in our application. Until 5.x the
following spring configuration used to work well for us:
<drools:kbase id="*validationRulesKBase*">
<drools:resources>
<drools:resource type="DRL"
source="classpath:rules/trade/rule1.drl" />
<drools:resource type="DRL"
source="classpath:rules/trade/rule2.drl" />
</drools:resources>
</drools:kbase>
With an inejection of this KnowledgeBase, we would create a stateless
session and fire all rules after inserting appropriate facts and globals.
After upgrading to Drools 6, our DRL files don't seem to be getting picked
up in the knowledge base - we are using the following spring configuration:
<bean id="kiePostProcessor"
class="org.kie.spring.KModuleBeanFactoryPostProcessor"/>
<kie:kmodule id="kieModule">
<kie:kbase name="validationRulesKBase" packages="com.acme.rules"/>
</kie:kmodule>
This KnowledgeBase gets injected in our code but it doesn't seem to pick up
the DRL files in the specified package. We have ensure that the drl files
are under src/main/resources/*com/acme/rules *and that package is specified
in each DRL file at the top.
Am I missing something in this new configuration?
thnx,
-mayank
12 years
Drools 6.0.0.Final - importing rules from multiple maven projects
by Soumya.plavaga
We want to keep separate the client specific rules & common set of rules. We
have created two different maven projects. one project having the common
drls say 'A'. Another project having the client specific drls say 'B'. 'B'
having dependency on 'A'. We want to load the rules in run time. We have
tried the below approach -
Tried to retrieve the kieSession using release id of project 'B' and fired
all rules in that kieSession. But only the rules of project 'B' is getting
executed but the rules within project 'A' are not getting loaded.
What can be the possible approach to import rules from multiple projects.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-0-Final-importing-rules-from...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
condition operator "||" give NPE in 6.0 but 5.x is fine
by wtang
I have a rule below and the "||" operator is giving me null pointer exception
(NPE) when the rule is invoked. This NPE problem is only happening is 6.0.
This NPE problem does not happen in 5.x and runs without and issues in 5.x
Is this a bug in Drools 6.0?
Below is my simple rule:
rule "rule using Map"
dialect "mvel"
when
$map: Map(
this["id"] == "1000" || // "||" operator works fine
in 5.x but gives NPE in 6.0
this["first"] == "Johna"
)
then
System.out.println("customer is: " + $map["first"] + " " +
$map["last"]);
end
Please let me know if this is a bug in 6.0x. thanks!
--
View this message in context: http://drools.46999.n3.nabble.com/condition-operator-give-NPE-in-6-0-but-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Driving License application
by seyfullah
Hello,
I am trying to implement Driving License example application in Drools
Documentation Versio 6.0.0.0 Final.
My main method is as below.
KieServices kieServices = KieServices.Factory.get();
KieContainer kContainer = kieServices.getKieClasspathContainer();
StatelessKieSession kSession = kContainer.newStatelessKieSession();
Applicant applicant = new Applicant("Mr John Smith", 16);
assertTrue( applicant.isValid() );
kSession.execute( applicant ) ;
assertFalse ( applicant.isValid() );
My licenseApplication.drl file is as below:
package MyPackage
import MyPackage.Applicant;
rule "Is of valid age"
when
$a : Applicant( age < 18 )
then
$a.setValid ( false );
end
Thanks to assertTrue and asserFalse methods, its output is
It is false as not expected
It is false as expected
Bu when I change age parameter from 16 to 22 its output is same again. I
expected that it is true.
I think there is something wrong.
Do you have any idea about this problem?
Regards
--
View this message in context: http://drools.46999.n3.nabble.com/Driving-License-application-tp4027403.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years