Guvnor - Unable to load a required class !! Help
by S.M.H.Jamali
Hello All
I create a JavaBean and convert it to a Jar File then upload it. Also i create a sample rule that uses uploaded Jar File then i create a test scenario to test my rule but when i run my scenario Guvnor says : Unable to load a required class ! Unable to find class 'Fire' !
my java bean is like it :
package com.employee;
import java.util.Date;
public class Fire
{
private Room room;
private Date time;
public Fire(){}
public Fire(Room room,Date time)
{
this.room = room;
this.time = time;
}
public Room getRoom() {
return room;
}
public void setRoom(Room room) {
this.room = room;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
}
Any Help Appreciated
Thanks in advance
S.M.H.Jamali
13 years, 3 months
Off to a very bad start - please help
by ronalbury
I downloaded droosljbpm-tools-distribution-5.2.0.Final and installed the
plugins in eclipse.
I downloaded droolsjbpm-integration-distribution-5.2.0.Final and imported
the example project into eclipse (Helios) per instructions in the
ReadMeDroolsjbpmintegration.txt file. I used the first
mechanism(File/Import) rather than the second (which required m2eclipse
plugin).
The project is full of errors, and none of the java files would compile.
There were no class files generated.
I created a Drools project from scratch. I copied the src directory from
the example into the new project. The java files now compile and the errors
are gone, however something is wrong because it can't find any of the drl
files. Also, src/main/resources is not showing in the project tree.
I believe that I have followed the directions to the letter (in the first
case), and took a wild stab (in the second case) and I am still at the
starting point.
Won't someone please help me (and shouldn't the ReadMe file be fixed so
others don't have this problem)
Thanks
Ron
--
View this message in context: http://drools.46999.n3.nabble.com/Off-to-a-very-bad-start-please-help-tp3...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Re: [rules-users] startsWith function
by Mattias Nilsson Grip
aftab wrote:
>
> I want to define rules for below function,
>
> private boolean isFixedNumber(Call call){
>
> if(call.getCalledNumber().startsWith("01") ||
> call.getCalledNumber().startsWith("02") ||
> call.getCalledNumber().startsWith("03") ){
> return true;
> }
> else{
> return false;
> }
> }
>
> Give some hints how can i define it ?
> I was trying to define it in below format,
> rule "Is Fixed Number"
> dialect "java"
> when c : CDRRecords
> (calledNumber.startsWith( "011") )
> then
> c.setFixedNetNumber(true);
> System.out.println("c.setFixedNetNumber (true) "); // consequence
>
> end
>
>
> Thanks in advance for your support ...
>
If you're using Drools 5.2 you should be able to do:
c : CDRRecords( calledNumber str[startsWith] "011" )
If you are on earlier version of Drools you can match with a regular
expression:
c : CDRRecords( calledNumber matches "011.*" )
/Mattias
--
View this message in context: http://drools.46999.n3.nabble.com/startsWith-function-tp3228735p3234795.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Drools Execution Server memory leak?
by Mike Reynolds
Using: 5.2.0.Final of drools camel server , JSON api, and a Stateless Session
We are making JSON calls to the camel (execution) server. Our
end-to-end unit tests pass. Our load tests, however, show that memory
is never reclaimed after each call to the rules engine. After parsing
through a heap dump, we see the following path taking up over 800 meg of
memory:
(kagent) KnowledgeAgentImpl$ChangeSetNotificationDetector
> (kbase) KnowledgeAgentImpl
>> (ruleBase) KnowledgeBaseImpl
>>> (eventSupport) ReteooRuleBase
>>>> (listeners) RuleBaseEventSupport
>>>>> (array) CopyOnWriteArrayList
>>>>>> ReteooWorkingMemory (around 864K of these)
The rule base is very small and simple - this is only a problem during a load test (or over the course of a weeks worth of calls). We make the following call 10K times:
{
"batch-execution": {
"lookup": "ksession1",
"commands": [
{
"insert": {
"out-identifier": "tc_1",
"object": {.....}
}}]}}
The knowledge-services.xml configures :
- kagent id="agent1" kbase="kbase1" new-instance="true"
- ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"
The rules just update the inserted "timecard" fact.
Because I'm using a stateless session, I don't think I need to
dispose of the agent...and I don't think there is a way to call dispose
using the json/Execution Command api.
We are calling the camel (execution) server from a non-java
environment to process employee timecards entries and evaluate for
overtime calculations.
Thanks!
Mike
13 years, 3 months
Inserting multiple objects of the same class as facts
by Devarakonda, Murty
Hello,
I am facing a problem with the following code with Drools 5.0.1:
I insert multiple objects as facts into my stateful session here:
===============================================================
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
/** mapTypes here is an array of MapType objects **/
for(int i=0;i<mapTypes.length;i++) {
System.out.println("Inserting the fact type: " + mapTypes[i]);
ksession.insert(mapTypes[i]);
}
ksession.insert(ldapLookupKey);
ksession.insert(ldapResponseMap);
ksession.fireAllRules();
ksession.dispose();
===============================================================
And here is my drools file:
===============================================================
rule "LocalRecipient"
when
$myMapType : MapType( name == "LocalRecipient" )
$lookupKey : String()
$ldapResponseMap : Map()
eval( ((($ldapResponseMap.get("zimbraMailDeliveryAddress").equals($lookupKey)) ||
($ldapResponseMap.get("zimbraMailAlias").equals($lookupKey)) ||
($ldapResponseMap.get("zimbraMailCatchAllAddress").equals($lookupKey))) &&
($ldapResponseMap.get("zimbraMailStatus").equals("enabled"))) )
then
System.out.println("This LocalRecipient rule should work");
$myMapType.setQueryFilterCheck(true);
end
rule "VirtualMailboxDomain"
when
$myMapType : MapType( name == "VirtualMailboxDomain" )
$lookupKey : String()
$ldapResponseMap : Map()
eval( (($ldapResponseMap.get("zimbraDomainName").equals($lookupKey)) &&
($ldapResponseMap.get("zimbraDomainType").equals("local")) &&
($ldapResponseMap.get("zimbraMailStatus").equals("enabled"))) )
then
System.out.println("This VirtualMailboxDomain rule should work");
$myMapType.setQueryFilterCheck(true);
End
===============================================================
Now the problem I am facing is, as long as I defined only rule001 above, it works like a charm and the MapType.QueryFilterCheck flag gets set to TRUE.
As soon I put the rule002 above, I started getting a NullPointerException with the following lines in the stack trace.
===============================================================
Caused by: java.lang.NullPointerException
at com.aol.postfixcache.Rule_LocalRecipient_Rule_0.eval0(Rule_LocalRecipient_Rule_0.java:8)
at com.aol.postfixcache.Rule_LocalRecipient_Rule_0Eval0Invoker.evaluate(Rule_LocalRecipient_Rule_0Eval0Invoker.java:23)
at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:117)
===============================================================
I tried different combinations along with an extensive search to see why I am getting this, but couldn't crack it. Appreciate your help.
Regards,
Murty.
13 years, 3 months
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[
by bhavindalal
Hello,
I am new to Drools. On starting to execute a simple program, eclipse gives
the following stacktrace as error. I even included the org.eclipse.jdt that
comes with eclipse, but it is still giving me error. Anybody please suggest
the problem. I am using Drools 5.0 and its dependencies and Eclipse Helios
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at
org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:321)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:690)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:653)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:40)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/org-eclipse-jdt-internal-compiler-Compi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
a newbi question
by wutongjoe
hello all,
I am a newbi on Drools and started my test work with a modified exapmle
included in drools v4.0.7.The compiled drl from a very simple modified xls
file is like the follwing :
----------------------code-----------------------
package org.drools.examples.decisiontable;
#generated from Decision Table
import org.apache.commons.lang.time.DateUtils;
import java.util.Date;
#From row number: 11
rule "Pricing bracket_11"
when
DateUtils.SEMI_MONTH==1001
then
policy.setBasePrice(9999999);
end
-------------------------code---------------------
but I got an exception stack when trying to addPackage after compile :
--------------stack----------------
Exception in thread "Main Thread" org.drools.rule.InvalidRulePackage:
[9,22]: unknown:9:22 mismatched token: [@46,221:222='==',<76>,9:22];
expecting type LEFT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:424)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)
at
org.drools.examples.PricingRuleDTExample.buildRuleBase(PricingRuleDTExample.java:67)
at
org.drools.examples.PricingRuleDTExample.executeExample(PricingRuleDTExample.java:38)
at
org.drools.examples.PricingRuleDTExample.main(PricingRuleDTExample.java:26)
--------------stack----------------
yes,I was trying to test the usage of org.apache.commons.lang.time.DateUtils
inside a xls file,but it seemed something went wrong.Can someone tell me
what caused the exception? thanks a lot
--
View this message in context: http://drools.46999.n3.nabble.com/a-newbi-question-tp3234838p3234838.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Re: [rules-users] Help needed
by Mattias Nilsson Grip
prasad.pbc wrote:
>
> Hi Guys,
> Iam using Eclipse tool for writing drl , i have written drl .
> Then i have written an ant script to convert this drl to PKG .
> i have used drools5.1.1.jars. i was sucessfully convert drl to pkg.
>
> knowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> kbuilder.add( ResourceFactory.newFileResource(
> "c:/Sample.pkg" ),
> ResourceType.PKG );
> iam getting below error:
>
> java.lang.ClassCastException: org.drools.reteoo.ReteooRuleBase cannot be
> cast to org.drools.rule.Package
> at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:487)
> at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
> at com.test.rules.MyRulesEngine.<init>(MyRulesEngine.java:51)
> at com.test.rules.MyRulesEngine.getInstance(MyRulesEngine.java:39)
> at com.test.rules.MyRulesExecuter.main(MyRulesExecuter.java:38)
>
>
> Can anybody help resolving my problem..
>
> Thanks
> prasad
>
Based on the stack trace I would guess that the file Sample.pkg contains a
serialized KnowledgeBase and not a serialized KnowledgePackage. Maybe you
could try to do your export like this:
KnowledgeBase kbase = ...;
KnowledgePackage kpackage = kbase.getKnowledgePackages().iterator().next();
FileOutputStream fos = new FileOutputStream(new File("c:/Sample.pkg"));
DroolsStreamUtils.streamOut(fos, kpackage);
/Mattias
--
View this message in context: http://drools.46999.n3.nabble.com/Help-needed-tp3224168p3234832.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months