incompatible error
by Sikkandar Nawabjan
Hi,
Am using drools 5 and am getting following error when I do packaging the
drl and dsls
org.drools.base.SalienceInteger incompatible with org.drools.rule.Rule
what could be the reason?
Thanks
sikkandar
14 years, 11 months
Does rule execution block when the Knowlege Agent is rebuild KnowlegeBase???
by Wing
Hello Drools User,
I am using Knowlege Agent to monitor changes in the repository. I have
started the following services:
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
I was able to change the rules in the repository and the changes did get
pick up in my application and everything is working fine as expected.
However, I have a question regarding rule execution when the Knowlege Base
is in the middle of being build by the Knowlege Agent. What happen when I
execute the rules using:
ksessionStateless = knowledgeAgent.newStatelessKnowledgeSession();
ksessionStateless.execute(ObjList);
Will the method ksessionStateless.execute(ObjList) block and wait until the
Knowlege Base is finish being build by the knowledge agent or the method
won't block and just pick up the old Knowlege Base and then switch to the
new knowlege base when the knowlege agent is finish building it? Will the
method ksessionStateless.execute(ObjList) block or not block?
thanks very much in advace for any help on this!
Wing Tang
--
View this message in context: http://n3.nabble.com/Does-rule-execution-block-when-the-Knowlege-Agent-is...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
ConsequenceException when retract from entry point
by jschmied
Hi!
I have
rule "test 3"
when
$t : My_Type() from entry-point "NM"
then
entryPoints["NM"].retract($t)
end
I get a:
org.drools.runtime.rule.ConsequenceException: rule: test 3
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:981)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:918)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1130)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:739)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:705)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:200)
at com.sample.ProcessTest.main(ProcessTest.java:97)
Caused by: [Error: unable to resolve method:
org.drools.common.NamedEntryPoint.retract(my.package.My_Type) [arglength=1]]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:905)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:315)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:138)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:133)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:104)
at org.mvel2.MVEL.executeExpression(MVEL.java:995)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:87)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:972)
... 6 more
what can I do?
Thanks
Juergen
--
View this message in context: http://n3.nabble.com/ConsequenceException-when-retract-from-entry-point-t...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
infinite loop in decision table
by djb
Hi,
I have successfully used UNLOOP to stop repitition of rules in my decision
table when one rule fires when all rules are mutually exclusive...
but I've got two rows/rules matching a condition for a given input, and it
is back to an infinite loop.
Is there something like lock-on-active for a decision table?
My table is basically something like the following, with an update in the
action:
Tariff X Minimum age Maximum Age
1234 5 <blank>
2345 <blank> 30
It checks whether a claim has a tariff, so so if a claim has both tariffs
and is between those two ages, it gets into an infinite update loop.
Thanks,
Daniel
--
View this message in context: http://n3.nabble.com/infinite-loop-in-decision-table-tp129933p129933.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
Is it possible to restore StatefulKnowledgeSession?
by Grigoriev, Grigoriy
Hi everyone,
I have a ruleflow that calls a ruleflow group.
In rhs of one of the rules in the ruleflow group an Exception is thrown. After that, when I insert a new fact into the working memory, the activations for the new fact are not created. To make the session work again, I call .getAgenda().clear(). However, session works incorrectly after that.
Is there any other way to 'restore' the StatefulKnowledgeSession, after it has thrown an Exception or should I always create a new session in this case?
With best regards,
Grigoriy.
14 years, 11 months
KnowledgeAgent and Guvnor restart
by Gerret Hansper
Hello,
I have got an issue with the KnowledgeAgent that seems not to survive a Guvnor
restart. The scenario is as follows:
* We use Drools 5.0
* On our application server we create a KnowledgeAgent
applying a ChangeSet that points to a package binary on a separate Guvnor server
like so:
SystemEventListenerFactory.setSystemEventListener(new
SystemEventLogger());
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
KnowledgeAgent agent =
KnowledgeAgentFactory.newKnowledgeAgent(workflowName);
agent.applyChangeSet(changeSet);
* Creating the kbase, registering globals and running sessions works fine.
* We shut down Guvnor (or the connection goes down, this was how we spotted the
problem) and restart it after a minute
* We then try to run sessions from the
same agent as above via
kagent.getKnowledgeBase().newStatefulKnowledgeSession();
which returns a ksession, but then setting a global we get
java.lang.RuntimeException: Unexpected global [log]
at
org.drools.common.AbstractWorkingMemory.setGlobal(AbstractWorkingMemory.java:5
50)
at
org.drools.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessio
nImpl.java:284)
>From the debugger I can see that indeed the ruleBase's globals map is empty. The
SystemEventLogger indicates that the KnowledgeAgent unsubscribes from its
resource when Guvnor is down and rebuilds its kbase. Also, it stops scanning the
resource and does not find it once Guvnor is up again. (See log snippet below).
Wouldn't it be better in these cases to keep the resource as is in memory and
try to rescan? I figure that as long as the resource is specified in the
changeSet it should be considered part of the kbase and not be removed if it
cannot be found.
For the time being, does anyone have a suggestion how to avoid these problems?
We could catch the RuntimeException and recreate the KnowledgeAgent, but perhaps
there is a better way?
Thanks, Gerret
-- SystemEventLog --
# Guvnor is up here
07:58:01,881 ResourceChangeScanner attempt to scan 1 resources
07:58:02,209 ResourceChangeScanner thread is waiting for 60
07:58:15,067 ResourceChangeScanner attempt to scan 1 resources
# Guvnor goes down here
07:58:16,738 ResourceChangeScanner removed resource=[UrlResource
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST']
07:58:16,738 ResourceChangeNotification received ChangeSet notification
07:58:16,738 ResourceChangeScanner thread is waiting for 60
07:58:16,738 ResourceChangeNotification processing ChangeSet
07:58:16,738 ResourceChangeNotification ChangeSet removed resource=[UrlResource
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] for
listener=org.drools.agent.impl.KnowledgeAgentImpl@1053d6d
07:58:16,738 ResourceChangeNotification ChangeSet removed resource=[UrlResource
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] for
listener=org.drools.agent.impl.KnowledgeAgentImpl@b71c17
07:58:16,738 KnowledgeAgent received ChangeSet changed notification
07:58:16,738 KnowledgeAgent received ChangeSet changed notification
07:58:16,738 KnowledgAgent applying ChangeSet
07:58:16,738 ResourceChangeNotification thread is waiting for queue update
07:58:16,738 KnowledgAgent applying ChangeSet
07:58:16,738 KnowledgeAgent unsubscribing from resource=[UrlResource
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST']
07:58:16,738 ResourceChangeNotification unsubscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@1053d6d to
resource=[UrlResource path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST']
07:58:16,738 KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
07:58:16,738 KnowledgeAgent unsubscribing from resource=[UrlResource
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST']
07:58:16,738 ResourceChangeNotification unsubscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@b71c17 to
resource=[UrlResource path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST']
07:58:16,738
KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
07:58:16,738 KnowledgeAgent new KnowledgeBase now built and in use
07:58:16,738 KnowledgeAgent new KnowledgeBase now built and in use
07:59:02,202 ResourceChangeScanner attempt to scan 0 resources
07:59:02,202 ResourceChangeScanner thread is waiting for 60
# Guvnor back up here
07:59:16,731 ResourceChangeScanner attempt to scan 0 resources
07:59:16,731 ResourceChangeScanner thread is waiting for 60
14 years, 11 months
Rule Templates with empty cells
by jschmied
Hi!
If I write rules in a decision table I can leave cells empty if I don't need
to use all of the conditions in a row.
How can I do this with the ExternalSpreadsheetCompiler?
I would need something like:
rule "rule_(a){row.rowNumber}"
when
$s : MyType1()
@ifDefined{field1} $e : MyType2(val1 == "@{field1}") from $s.SUB;
@ifDefined{field2} $e : MyType2(val2 == "@{field2}") from $s.SUB;
then
retract($s);
end
Thanks
Juergen
--
View this message in context: http://n3.nabble.com/Rule-Templates-with-empty-cells-tp138571p138571.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
"collection contains" problem
by Mike Dougherty
Hello all,
I've been getting more and more into using Drools Expert, but I certainly still have a lot to learn. I have almost a complete rules file ready to go. But I am having an issue with the LHS checking that a collection contains a certain object value. The rule currently looks like this:
rule "Rule Name"
no-loop true
when
property : StatusProperty( name == "propertyName", value == "valueA" )
t : TrainingStatus( currentSection == "section_a", properties contains property )
then
t.setNextSection( "section_b" );
t.setPreviousSection( "section_overview" );
update( t );
end
The TrainingStatus object has the following fields:
public class TrainingStatus implements Serializable {
private String currentSection;
private String nextSection;
private String previousSection;
private Set<StatusProperty> properties = new TreeSet<StatusProperty>();
}
And the StatusProperty object has the following:
public class StatusProperty implements Serializable {
private String name;
private String value;
}
I'm inserting a TrainingStatus object that should match this rule. But the resulting object does not have the nextSection and previousSection fields set to the values they should.
Can anyone advise on how to get this rule working as expected?
Thanks for your help!
Mike
14 years, 11 months