Using a DRL file on Guvnor/Workbench while using Drools Camel Server
by jordan.brown
So far in my attempts, I am unable to use a DRL file that exists on Drools
Workbench/Guvnor while using Drools Integration with Apache Camel. I would
like to be able to use a rule file that can be managed from the UI, along
with KIE scanner, monitoring the maven repository for changes. I'm sourcing
from the JAR coming from the remote repository of Guvnor, where the DRL
lies, but it's not picking it up in the server so far in my testing.
I have the Drools Camel Server up sending messages and executing rules
against the knowledge session, but as of right now, the DRL file is created
locally.
I'm not seeing anything on the documentation concerning my question.
--
View this message in context: http://drools.46999.n3.nabble.com/Using-a-DRL-file-on-Guvnor-Workbench-wh...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Drools 5.5.0 - Runtime Exception java.lang.RuntimeException: Provider org.drools.agent.impl.KnowledgeAgentProviderImpl could not be set
by anjana.ackroyd
Here is my snippet of my code in 5.5.0.Final
import org.drools.KnowledgeBase;
import org.drools.agent.KnowledgeAgent;
import org.drools.agent.KnowledgeAgentFactory;
import org.drools.definition.type.FactType;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatelessKnowledgeSession;
KnowledgeAgent ka = KnowledgeAgentFactory.newKnowledgeAgent("MyAgent");
ka.applyChangeSet(
ResourceFactory.newClassPathResource("src/main/resources/ChangeSet.xml") );
KnowledgeBase kb = ka.getKnowledgeBase();
FactType factType =
kb.getFactType("org.numbercompare","NumberCompare");
Object nc = factType.newInstance();
factType.set( nc, "numberone",numberone );
factType.set( nc, "numbertwo", numbertwo );
StatelessKnowledgeSession ks = kb.newStatelessKnowledgeSession();
ks.execute(nc);
I get the following error
java.lang.RuntimeException: Provider
org.drools.agent.impl.KnowledgeAgentProviderImpl could not be set
Here are my dependencies in pom.xml
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>5.5.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>5.5.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>knowledge-api</artifactId>
<version>5.5.0.Final</version>
</dependency>
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-5-0-Runtime-Exception-java-lan...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
How to push changes to cloned repo on Kie-Workbench
by anjana.ackroyd
I was able to do all my steps successfully on the work bench , Cloned my
repository, added a new project, package,drl file, build and deployed it.
I see wb created the repositories on my local machine which is good but I
dont see a way to push those changes to my cloned reposity
Git Push?
I am not even sure what branch of the cloned repository the work bench is
using
I noticed on this URL below there is recommendation to use the
./kie-config-cli.sh script to push changes
http://docs.jboss.org/drools/release/6.0.0.Final/drools-docs/html/wb.Work...
I downloaded the zip file from
https://github.com/droolsjbpm/kie-wb-distributions/tree/6.0.x
Ran the script from \kie-config-cli\src\main\dist but I get a error message
Exception in thread "main" java.lang.NoClassDefFoundError:
org/kie/config/cli/CmdMain
Caused by: java.lang.ClassNotFoundException: org.kie.config.cli.CmdMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.kie.config.cli.CmdMain. Program will
exit.
I was hoping there would be a way to push my changes from the Workbench UI
itself.
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-push-changes-to-cloned-repo-on-K...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Null pointer when inserting data (5.5.0.Final)
by Anders Henriksson
Hi!
We're running drools in a multi-server setup, with a pretty basic scenario:
1. When the first session is needed, we load the rulebase once. The rulebase is never changed after this (no rule removal or addition).
2. Each call spawns a new StatefulKnowledgeSession which is used for firing the rules once and then disposed. These calls are heavily multi-threaded, but each session is only used in a single method call from a single thread.
3. We use the resource scanner to check for updated packages. When an updated knowledge package is available, the knowledgebase is discarded and a new one constructed from the updated package.
The knowledge package affected is somewhat large - about 25 MB in size. (There are other, smaller knowledge packages which do not appear to have this issue.)
This setup has been working fine, but somewhat slow. After upgrading to 5.5.0.Final and adding some speedups in the surrounding code we get a spurious null pointer. The trail of events is:
1. After start all servers work fine.
2. Sometime after a couple of hours to a couple of days, the null pointer error occurs on one or more servers (but generally not all of them).
3. Once the null pointer occurs, it happens on all further calls using that knowledgebase. No other knowledgebases are effected. (You can load the same package in a new knowledgebase, and sessions using the new, identical, knowledgebase work just fine.)
4. Restarting the java process makes the server work fine again.
Calls always fail with the same stack trace:
org.drools.RuntimeDroolsException: Unexpected exception executing action org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction@5db53f
24
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:995)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:335)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
<stacktrace from our calling code omitted>
Caused by: java.lang.NullPointerException
at org.drools.rule.EvalCondition.createContext(EvalCondition.java:107)
at org.drools.reteoo.EvalConditionNode.createMemory(EvalConditionNode.java:261)
at org.drools.common.ConcurrentNodeMemories.createNodeMemory(ConcurrentNodeMemories.java:90)
at org.drools.common.ConcurrentNodeMemories.getNodeMemory(ConcurrentNodeMemories.java:69)
at org.drools.common.AbstractWorkingMemory.getNodeMemory(AbstractWorkingMemory.java:1034)
at org.drools.reteoo.EvalConditionNode.assertLeftTuple(EvalConditionNode.java:174)
at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:196)
at org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:145)
at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:154)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.reteoo.Rete.assertObject(Rete.java:109)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:286)
at org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:434)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:993)
... 93 more
Unfortunately we don't have the remaining rows in the wrapped exception.
>From this trace, it looks like the problem is in EvalCondition:
public Object createContext() {
return this.expression.createContext();
}
which should only be able to produce a null pointer if expression is missing. Looking at the constructors for this class, having a null expression seems like a valid use case - but if this is a valid use case, why doesn't createContext() handle this case?
Considering that running drools with the same package and the same inputs can either fail with the above error (if knowledgebase has been used enough) or work just as intended (using a newly minted knowledgebase), it feels like something is corrupting the knowledgebase. Does this make sense?
(I noticed in the issue tracker ( https://issues.jboss.org/browse/DROOLS-156 ) that memory for eval nodes are 'created "too lazily"' - might this be a related issue?)
Best regards,
Anders
12 years, 3 months
Sending Java Objects Through Camel, received by Drools 6
by jordan.brown
Hi,
We're currently testing sending XML/JSON (including a message and drools
commands) through Camel and Drools receiving it (using the documentation
given--Part IV Drools Integration in the Doc), but we're curious if it's
possible to just send a Java Object (e.g., Person Object) through Camel and
have Drools pick it up--whereby the object will be received by drools and
then the actual insert and firing of rules will occur on the other side
(i.e., we wouldn't send the drools commands to Camel).
Out-of-the-box, is this possible? Anybody doing this? As of now, we're
continuing the approach in the Drools documentation (Part IV Drools
Integration).
-Jordan
--
View this message in context: http://drools.46999.n3.nabble.com/Sending-Java-Objects-Through-Camel-rece...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Drools6 : Having trouble in using kie-ci
by vimalkansal
Hi,
I have an instance of Kie-WB running and I have started it with property
"org.guvnor.m2repo.dir" set to some non default location (i.e not in
/../home/.2). I am able to use the KIE WB to "build and deploy" the project
to this repository. Then I have built a web application ( I have declared
the dependency on org.kie/kie-ci module and I have verified that this jar is
getting packaged under WEB-INF/lib folder of my .war file). So with this
setup, when I have a code like this in my web application :
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = null;
*kContainer = ks.newKieContainer(ks.newReleaseId("com.xyz", "HelloWorld",
"1.0.0-SNAPSHOT"));*
it seems to wait inordinately long at the highlighted line and then throws
up an exception to the telling can't get the default Kie Session. My
question :
Do I have to tell the web application about the location of the maven
repo? if yes how?
Thx
Vimal
--
View this message in context: http://drools.46999.n3.nabble.com/Drools6-Having-trouble-in-using-kie-ci-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
InstantiationError during condition evaluation in Drools 6.0.0.Final
by Loïc Albertin
Hi all,
I'm migrating from an old Drools 5.1 version to 6.0.0.Final. Sometimes
(I don't really get under which conditions as sometimes it works), I'm
facing an InstantiationError exception when I insert a fact into a
stateful kie session. This exception is thrown by a generated class
named ConditionEvaluator<UUID> which doesn't help for debugging! ;)
The inserted object is a basic POJO (named JasmineEventEB) except for an
attribute named "value" which accept any "Serializable" object and which
is causing the issue.
The rule condition is quite simple
$e : JasmineEventEB(probe == "Button:pris" && value == "1")
In debugging I found that it failed when evaluating the value == "1"
part. I can also confirm that the value for the actually inserted
JasmineEventEB is a string.
The stacktrace is:
java.lang.InstantiationError: java.io.Serializable
at
ConditionEvaluatorae1a73837e8146bda23004a0450e2e52.evaluate(Unknown Source)
at
org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:212)
at
org.drools.core.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:169)
at
org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:134)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:502)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:387)
at
org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:138)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:502)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:377)
at
org.drools.core.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:288)
at
org.drools.core.reteoo.EntryPointNode.assertObject(EntryPointNode.java:260)
at
org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:360)
at
org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:279)
at
org.drools.core.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1149)
at
org.drools.core.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1093)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:308)
I tested both with the java and mvel dialect with the same result.
Does someone has already encountered this kind of error?
If you need more details or clarifications please let me know.
Thanks & regards,
Loïc
12 years, 3 months
Drools 5.5.0.Final : Rule Trigger Issue
by Zahid Ahmed
Hi,
I am new to Rules and having following issues in different rules.
Rule 1 :
Issue
I have a process definition in which I create and insert into Session a REQUEST.java object before the rule-flow node. Insert is done using script node. In rule condition section I am filtering the same request object but my rule is not firing. My rule FIRES if I REMOVE this == $process.getVariable("piRequest").
rule "Go to President"
ruleflow-group "DesigSkip"
dialect "java"
when
$process: WorkflowProcessInstance()
$r: Request(this == $process.getVariable("piRequest"), VD == "N", UB == "N", CC not in ( "A", "B") , DP not in ( "X", "Y", "Z") );
then
$process.setVariable("piToPres","y");
end
Rule 2 :
I am getting error for eval statement.
globa Request $r;
rule "Go to President"
ruleflow-group "DesigSkip"
dialect "java"
when
$process: WorkflowProcessInstance($request:getVariable("piRequest"))
$r : $request
$r(eval(ADV == "N"))
then
System.out.println("--------------------*******************--------IN GUIDED RULE--------**********************---------------");
$process.setVariable("piToPres","y");
end
globa Request $r;
rule "Go to President"
ruleflow-group "DesigSkip"
dialect "java"
when
$process: WorkflowProcessInstance($request:getVariable("piRequest"))
$r : $request
eval($r.getADV() == "N")
then
System.out.println("--------------------*******************--------IN GUIDED RULE--------**********************---------------");
$process.setVariable("piToPres","y");
end
Zahid Ahmed
Senior Software Engineer | Emirates Group IT
P.O. Box 686 | Dubai, United Arab Emirates
T +971 4 203 3912 | M +971 55 1249171
[http://cdn.ek.aero/email/e_signatures/ekg2013.jpg]
12 years, 3 months