Unable to find implementation for BusinessRuleProvider
by John Peterson
Hi,
I've been experimenting with the Guided Rule Editor plug-in in Eclipse.
I've built a Drools Project using the default Hello World sample
application. I've created a new "Guided Rule" in my project called
"GuidedRule.brl" and get the associated "drools.package" with it. The
rule is simple:
WHEN
THEN
System.out.println("Rule has fired");
I build the knowledge base as follows:
private static KnowledgeBase readKnowledgeBase() throws
Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("SampleGuided.drl"),
ResourceType.BRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not
parse knowledge.");
}
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
The only line changed is adding the resource of type BRL.
When I try to run, I get the following error:
java.lang.RuntimeException: org.drools.compiler.DroolsParserException:
org.drools.CheckedDroolsException: Unable to find implementation for
BusinessRuleProvider
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:544)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:28)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:41)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Caused by: org.drools.compiler.DroolsParserException:
org.drools.CheckedDroolsException: Unable to find implementation for
BusinessRuleProvider
at
org.drools.compiler.PackageBuilder.addPackageFromBrl(PackageBuilder.java
:386)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:470)
... 3 more
Caused by: org.drools.CheckedDroolsException: Unable to find
implementation for BusinessRuleProvider
at
org.drools.compiler.BusinessRuleProviderFactory.throwNoImplementationFou
nd(BusinessRuleProviderFactory.java:66)
at
org.drools.compiler.BusinessRuleProviderFactory.loadProvider(BusinessRul
eProviderFactory.java:42)
at
org.drools.compiler.BusinessRuleProviderFactory.getProvider(BusinessRule
ProviderFactory.java:25)
at
org.drools.compiler.PackageBuilder.addPackageFromBrl(PackageBuilder.java
:366)
... 4 more
I've tried variations to add the drools.package as a PKG type, I've had
the rules (and package) in both "com.sample" and /src/main/rules, but I
can't seem to resolve the problem. "drools.package" has been updated to
include the package name (package com.sample;) and I import the message
class as well (even though it isn't being used currently).
I suspect the issue is simple, but I haven't been able to figure it out.
Any help would be appreciated.
13 years, 5 months
Protobuf Marshaller Question (ScheduledActivation Persistence)
by Philipp Herzig
Dear developers,
I believe this is a question for Edson.
I wonder if ScheduledActivations are added to the Agenda when
unmarshalling an existing session and fired as well, e.g., non-expired
timers.
I guess that this worked with the DefaultMarshaller implementation (at
least I can see LOCs in the InputMarshaller where normal or scheduled
activations are added to the newly created agenda). I cannot find
similar code in the ProtobufMarshaller or, more precisely, the
ProtobufInputMarshaller.
I also tried to override MarshallerProvider in order to use the
DefaultMarshaller but that is obviously not-consistent
(ClassCastException) with the current codebase anymore.
Hopefully, I am doing/understanding sth. completely wrong here.
Thanks for any help regarding this issue,
Philipp
13 years, 5 months
All the values from one list must be present in other
by Suvek
I tried looking for similar posts but could not find any that fits the
requirements.
Really speaking this is a 2 part question.
What I need to do is compare 2 lists and ensure that all the fields inside
the reference list are present in passed in list.
following is the simplified version of test that I want to perform...
$requiredAddressTypes : List() from [ AddressType.BUSINESS,
AddressType.FOREIGN_BUSINESS ]
$taxpayer : Taxpayer(taxpayerType == TaxpayerType.FOREIGN_BUISINESS &&
addresses.size > 0,
$addresses : addresses)
1 - Based on the taxpayer type I need to ensure that ALL the
requiredAddressTypes must be present, how can I achieve this?
2 - is the this statement correct ? ($requiredAddressTypes : List() from [
AddressType.BUSINESS, AddressType.FOREIGN_BUSINESS ])
--
View this message in context: http://drools.46999.n3.nabble.com/All-the-values-from-one-list-must-be-pr...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Deploy Drools in AS7 as OSGi bundles
by Dan Seaver
I'd like to use Drools as OSGi services in the JBoss Adaptive Server (version
7.1.1).
I haven't found any specifics about how to do this in the drools
documentation (or anywhere else with my google searches), so I'm attempting
to deploy the jars mentioned in the droolsjbpm-integration-docs via the
JBoss Management console. The jars are:
knowledge-api
drools-core
drools-compiler
drools-templates
drools-decisiontables
All of the jars install ok, but when I try to enable them (start the
bundles), I run into problems.
knowledge-api seems to start fine.
However, the other bundles have dependencies on drools-core.
When I try to enable drools-core, I get exceptions claiming the required
bundle, org.drools.internalapi, is missing. So, I added the following
bundle:
knowledge-internal-api.jar
Now I get the exception that package com.google.protobuf is missing.
*Any guidance on how to install drools in AS7 as OSGi services would be
greatly appreciated!*
Stack trace snippet from JBoss console when trying to deploy drools-core:
12:45:43,783 ERROR [org.jboss.osgi.framework.internal.FrameworkEventsPlugin]
(MSC service thread 1-2) Framework ERROR:
org.osgi.framework.BundleException: Cannot resolve bundle resModule:
[org.drools.core:5.4.0.Final]
at
org.jboss.osgi.framework.internal.ResolverPlugin.resolve(ResolverPlugin.java:157)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
at
org.jboss.osgi.framework.internal.AbstractBundleState.ensureResolved(AbstractBundleState.java:551)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
at
org.jboss.osgi.framework.internal.HostBundleState.startInternal(HostBundleState.java:211)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
at
org.jboss.osgi.framework.internal.AbstractBundleState.start(AbstractBundleState.java:494)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
at
org.jboss.as.osgi.deployment.BundleStartTracker$1.processService(BundleStartTracker.java:144)
[jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.as.osgi.deployment.BundleStartTracker$1.transition(BundleStartTracker.java:119)
[jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.msc.service.ServiceControllerImpl.invokeListener(ServiceControllerImpl.java:1416)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at
org.jboss.msc.service.ServiceControllerImpl.access$2700(ServiceControllerImpl.java:49)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at
org.jboss.msc.service.ServiceControllerImpl$ListenerTask.run(ServiceControllerImpl.java:1954)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[rt.jar:1.6.0_26]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[rt.jar:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
Caused by: org.jboss.osgi.resolver.XResolverException: Unable to resolve
Module[org.drools.core:5.4.0.Final]: missing requirement
[Module[org.drools.core:5.4.0.Final]] package; (package=com.google.protobuf)
at
org.jboss.osgi.resolver.felix.FelixResolver.resolveInternal(FelixResolver.java:117)
[jbosgi-resolver-felix-1.0.13.Final.jar:1.0.13.Final]
at
org.jboss.osgi.resolver.spi.AbstractResolver.resolve(AbstractResolver.java:149)
[jbosgi-resolver-spi-1.0.13.Final.jar:1.0.13.Final]
at
org.jboss.osgi.framework.internal.ResolverPlugin.resolve(ResolverPlugin.java:155)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
... 11 more
--
View this message in context: http://drools.46999.n3.nabble.com/Deploy-Drools-in-AS7-as-OSGi-bundles-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Stateless session with pre-inserted facts
by Chris Selwyn
I have a need to execute a set of rules on a complicated hierarchical data structure where some of the rules use a bunch of reference facts.
At the moment I load the reference facts and the hierarchical structure into the WM of a stateless session on every execution.
There are a lot of reference facts and they start off in the same state on every execution though they can get modified as part of the rules execution.
I would really like to be able to save the WM after inserting the reference facts so that I can start each execution with those facts pre-loaded and thereby avoid loading them each time.
Is this an easy thing to do? Could someone give me some pointers?
Chris
13 years, 5 months
Inserting String Object and accessing it in Guvnor
by Manasi
Hi,
Currently in my application I want to insert a *String object* into a
StatefulKnowledgeSession.
I don't want to insert object of any *User defined type* ,as input parameter
contains only one string parameter.
I am able to insert String object into my StatefulKnowledgeSession, but
don't know how to access it in Guvnor , as I want to use value from this
string object to satisfy one of the rule in my Guvnor decision table. I want
to use this String object as one of the condition columns in Guvnor.
Below is some code I am using:
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
String myString = new String("department");
session.insert(myString);
session.fireAllRules();
Is there any way to access this String object in Guvnor?
Thanks,
Manasi.
--
View this message in context: http://drools.46999.n3.nabble.com/Inserting-String-Object-and-accessing-i...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
function in drools
by thano
HI,
I am new to drools. I would like to know if it is possible to define a
function in drools or something similar. For example, Rule 1 would call
another rule say Rule 2 and pass some parameters to be analysed with in Rule
2. I need to know if this can be achieved purely in drools.
many thanks
--
View this message in context: http://drools.46999.n3.nabble.com/function-in-drools-tp4020021.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Does JIT give me a hard time?
by wasperen
Hi,
I have been using Drools for some years now and really happy with it!
But I am struggling now with the 5.4 version. It seems that the JIT compiler
does not like me. For example, I have a rule that says:
rule "activate operations, for operator"
when
$worker : VCMShiftWorker( selectQuery == "operatorSelect" )
$ea : ExecutableAction(
action.subject.parentActionable != null,
$worker.isUnderManagement( action.subject.parentActionable )
)
not RelevantExecutableAction(
$worker;
executableAction != $ea,
executableAction.priority > $ea.priority ||
(executableAction.priority == $ea.priority && executableAction.workTime >
$ea.workTime) ||
(executableAction.priority == $ea.priority && executableAction.workTime
== $workTime && $critical && ! executableAction.critical)
)
then
System.out.println($worker+" makes relevant :"+$ea);
insert( new RelevantExecutableAction( $worker, $ea ) );
end
When I run this, I get a Thread that tell me there is a NPE because $ea is
null... So I had to re-write that same rule as
rule "activate operations, for operator"
when
$worker : VCMShiftWorker( selectQuery == "operatorSelect" )
$ea : ExecutableAction(
$prio : priority,
$workTime : workTime,
$critical : critical,
action.subject.parentActionable != null,
$worker.isUnderManagement( action.subject.parentActionable )
)
not RelevantExecutableAction(
$worker;
executableAction != $ea,
executableAction.priority > $priority ||
(executableAction.priority == $priority &&
executableAction.workTime.compareTo($workTime) > 0) ||
(executableAction.priority == $priority && executableAction.workTime ==
$workTime && $critical && ! executableAction.critical)
)
then
System.out.println($worker+" makes relevant :"+$ea);
insert( new RelevantExecutableAction( $worker, $ea ) );
end
This works, but it's not nice.. And: why?
Also, I get errors like "java.lang.RuntimeException: Null accessor on node:
tick", again from these separate threads. I think this means that MVEL
cannot determine a getTick() from the fact that it should look at. In this
case, this.tick does also not work; same thing.
I tried to switch JIT off by adding the -Dmvel.disable.jit=true property to
the start-up, but that does not eliminate this issue.
A full stack-trace for the last error is as follows:
java.lang.RuntimeException: Null accessor on node: tick
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeNode(ConditionAnalyzer.java:229)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeNode(ConditionAnalyzer.java:162)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeSingleCondition(ConditionAnalyzer.java:109)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:102)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCombinedCondition(ConditionAnalyzer.java:134)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:94)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:73)
at
org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:83)
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:214)
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)
Another thing that fails to work in 5.4 is casting. For instance:
((Ship)mover).currentContainer does not compute. I get a Null accessor on
mover...
Should I worry about this at all? Or is it just bad luck this time and will
Drools just continue to process my rules?
To give you some context. We have built an agent based simulation engine,
where the agents are "Smart". They can interact, responding to the Actions
published by the agents in their environment by reasoning over them using
Drools rules. Works really nice but I am getting worried by these exceptions
now...
--
View this message in context: http://drools.46999.n3.nabble.com/Does-JIT-give-me-a-hard-time-tp4020032....
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Planner: Hard Constraint Prevents Moves and Swaps
by Jason Virtue
All,
I have a problem where I need to assign tasks:
1.) Times
2.) Resources based on a Resource Type
I've used the nurse rostering problem as an example and come up with a
planning entity ResourceAssignment that looks like:
Facts:
Task
ResourceType
Variables:
Time
Resource
For example:
1.) Lets say there are two resource types Type1 & Type2
2.) A pool of resources: Resource1(type1), Resource2(type1),
Resource3(type1), Resource4(type2), Resource4(type2), Resource5(type2) ...
3.) Task A: that requires 1 resource of type1 and one resource of type2
My program creates two PlanningEntities
ResourceAssignment1
Fact:
Task=A
ResourceType=1
Variables
Time
Resource
ResourceAssignment2
Fact:
Task=A
ResourceType=2
Variables:
Time
Resource
I've created a rule that is designed to keep tasks starting at the same
time:
//tasks need to be in the same timeSlot
rule "taskInTimeSlot"
when
$ra1 : ResourceAssignment ( task != null, time != null, $id : id, $task :
task, $time : time)
$ra2 : ResourceAssignment ( task != null, timeSlot != null, id != $id, task
== $task, time != $time )
then
insertLogical(new IntConstraintOccurrence("taskInTimeSlot",
ConstraintType.NEGATIVE_HARD,
1,$ra1, $ra2));
end
*PROBLEM*
This results in: Cancelled step index (7), time spend (2848): there is no
doable move. Terminating phase early.
If I change the constraint to a NEGATIVE_SOFT the problem is solved, but it
doesn't scale. Any more that a few tasks and it doesn't seem to be able to
find solutions.
What I need is for swaps and moves to change the time on multiple
ResourceAssignments together.
Am I going about the problem the right way? Do I need something other than
the generic move/swap factories?
Thanks in advance,
Jason
13 years, 6 months