Dynamic refresh from Guvnor in Web Application
by kappert
Version 5.5.0.Final (Guvnor and libraries)
Tomcat 6
Goal: We would like to change rules on-the-fly in Guvnor so they become
immediately effective in a web application running in Tomcat.
The function below is used to connect go Guvnor. It works fine in a
standalone Java program, but in the web application the updates in Guvnor
have no effect.
Does anybody have experience with this scenario?
Is there something wrong with the function used to connect to Guvnor?
Additional observation: Instead of loading the rules from Guvnor I have
tried loading them from a file, with refresh. The file is found the first
time when Drools starts, so the path is correct. When I change the rules
file in Eclipse the updated file is auto-deployed to Tomcat. Indeed Drools
realizes a change, /but fails to load the file with the following error:
Caused by: java.io.FileNotFoundException: 'org/somewhere/Rules.drl' cannot
be opened because it does not exist
at org.drools.io.impl.ClassPathResource.getURL(ClassPathResource.java:165)
at
org.drools.io.impl.ClassPathResource.getLastModified(ClassPathResource.java:177)/
Is it possible that Drools uses different methods for loading rules
initially and when an update is detected? Why would the file be found the
first time, but not after an update?
Function connecting to Guvnor with refresh
/**
* Creates a StatefulKnowledgeSession that accesses Guvnor using the
resource specification in
* the provided changeset. Changes in the rules in Guvnor are detected
on-the-fly (scanner interval).
* "Build package" in Guvnor is required to activate changed rules.
* <p>
* TODO Services are started that detect changes in the Guvnor rules. They
should be shutdown when an application
* terminates. This should be imlemented in a production environment.
*
* @param pathChangeSet String with the location of the rules file. If your
rules file is in a top directory
* (for example src/main/rules), then the path is "changeset.xml".
If it is in a package
* org.somewhere, then the string is "org/somewhere/changeset.xml".
* @param scannerIntervalSeconds int, seconds between rescan of the rules
file
* @return StatefulKnowledgeSession
*/
public static StatefulKnowledgeSession
createStatefulKnowledgeSessionWithGuvnor(String pathChangeSet, int
scannerIntervalSeconds) {
final ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval",
Integer.toString(scannerIntervalSeconds));
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
final KnowledgeAgentConfiguration knowlegdeAgentConfiguration =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
knowlegdeAgentConfiguration.setProperty("drools.agent.newInstance",
"false"); // keeps the session
final KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("MyKnowledgeAgent",
knowlegdeAgentConfiguration);
final Resource changeset =
ResourceFactory.newClassPathResource(pathChangeSet);
kagent.applyChangeSet(changeset);
return kagent.getKnowledgeBase().newStatefulKnowledgeSession();
}
Function connecting to rules file with refresh
/**
* Creates a StatefulKnowledgeSession that uses the specified rules file.
* Changes in the rules file are detected on-the-fly (scanner interval).
* <p>
* TODO Services are started that detect changes in the rules file. They
should be shutdown when an application
* terminates. This should be imlemented in a production environment.
*
* @param pathRulesFile String with the location of the rules file. If your
rules file is in a top directory
* (for example src/main/rules), then the path is "rules.drl". If it
is in a package
* ch.sbb.eventhub, then the string is "ch/sbb/eventhub/rules.drl".
* @param scannerIntervalSeconds int, seconds between rescan of the rules
file
* @return StatefulKnowledgeSession
*/
public static StatefulKnowledgeSession
createStatefulKnowledgeSessionWithFile(String pathRulesFile, int
scannerIntervalSeconds) {
final ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval",
Integer.toString(scannerIntervalSeconds));
sconf.setProperty("drools.agent.newInstance", "false"); // not needed
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
final KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource(pathRulesFile),
ResourceType.DRL);
final KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (final KnowledgeBuilderError error : errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse knowledge.");
}
final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
final KnowledgeAgentConfiguration knowlegdeAgentConfiguration =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
knowlegdeAgentConfiguration.setProperty("drools.agent.scanResources",
"true"); // not neeeded
knowlegdeAgentConfiguration.setProperty("drools.agent.scanDirectories",
"true"); // not needed
knowlegdeAgentConfiguration.setProperty("drools.agent.newInstance",
"false"); // required!
final KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("From File", kbase,
knowlegdeAgentConfiguration);
return kagent.getKnowledgeBase().newStatefulKnowledgeSession();
}
--
View this message in context: http://drools.46999.n3.nabble.com/Dynamic-refresh-from-Guvnor-in-Web-Appl...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Drools: Using Declared Types in Decision Tables
by David Smith
Hi,
I am trying to use a declared type in a decision table
but get an "Unable to resolve ObjectType" message.
The declared type is in a file types.drl,
I have a spreadsheet test.xls that has a Ruleset with
an import line for the declared type.
Is it possible to reference a declared type from a decision table?
Is it possible to declare a type in a decision table?
Thanks
David
11 years, 10 months
Fw: proble with localSearch
by Michiel Vermandel
Hi Geoffrey,
Thanks for your advice.
Indeed one of the planning variables is consistently null over all planning entities.
Should drools planner take care of this or should I impose an extra rule to exclude these selections?
Once again I seem to struggle with nulls being passed in as planning variable...
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
________________________________
From: Geoffrey De Smet <ge0ffrey.spam(a)gmail.com>
To: Michiel Vermandel <mvermand(a)yahoo.com>; Rules Users List <rules-users(a)lists.jboss.org>
Sent: Tuesday, January 8, 2013 4:27 PM
Subject: Re: proble with localSearch
Op 08-01-13 15:24, Michiel Vermandel schreef:
Hi,
>
>I'm trying to implement a basic local search (really new to it).
>
>When I run my project I now get:
>
>Exception in thread "main" java.lang.IllegalStateException:
Phase localSearch started with an uninitialized Solution. First
initialize the Solution. For example, run a phase
constructionHeuristic first.
> at
org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.phaseStarted(DefaultLocalSearchSolverPhase.java:120)
>
You have a construction heuristic configured, so all @PlanningVariable's should be different from null after that phase is ended.
So when the local search phase starts, that check should be ok and
not throw that exception.
Comment out local search, write the solution to disk an verify that
all planning variables are now not null.
Or debug where that exception is throw and inspect
phaseScope.getSolverScope().getScoreDirector().getWorkingSolution().
>This is my config:
>
><?xml version="1.0" encoding="UTF-8"?>
><solver>
> <environmentMode>DEBUG</environmentMode>
>
> <!-- Domain model configuration -->
>
<solutionClass>be.axi.planner.app.InspectionSchedule</solutionClass>
>
<planningEntityClass>be.axi.planner.domain.Task</planningEntityClass>
>
> <!-- Score configuration -->
> <scoreDirectorFactory>
>
<scoreDefinitionType>HARD_AND_SOFT</scoreDefinitionType>
> <scoreDrl>/inspectionRules.drl</scoreDrl>
> </scoreDirectorFactory>
>
> <constructionHeuristic>
>
<constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType>
> <!--
constructionHeuristicPickEarlyType>FIRST_LAST_STEP_SCORE_EQUAL_OR_IMPROVING</constructionHeuristicPickEarlyType-->
> </constructionHeuristic>
>
> <localSearch>
> <termination>
>
<terminationCompositionStyle>OR</terminationCompositionStyle>
>
<maximumSecondsSpend>3600</maximumSecondsSpend>
>
<scoreAttained>0hard/0soft</scoreAttained>
> </termination>
> <unionMoveSelector>
> <changeMoveSelector>
> <valueSelector>
>
<planningVariableName>period</planningVariableName>
> </valueSelector>
> </changeMoveSelector>
> <changeMoveSelector>
> <valueSelector>
>
<planningVariableName>spector</planningVariableName>
> </valueSelector>
> </changeMoveSelector>
> <changeMoveSelector>
> <valueSelector>
>
<planningVariableName>type</planningVariableName>
> </valueSelector>
> </changeMoveSelector>
> <swapMoveSelector>
> </swapMoveSelector>
> </unionMoveSelector>
>
> <acceptor>
>
<planningEntityTabuSize>7</planningEntityTabuSize>
> </acceptor>
> <forager>
>
<minimalAcceptedSelection>1000</minimalAcceptedSelection>
> </forager>
> </localSearch>
>
></solver>
>
> Any thoughts on what I'm doing wrong?
>
>Thanks
>
>Michiel
>
>-----------------
>http://www.codessentials.com - Your essential software, for free!
>Follow us at http://twitter.com/#!/Codessentials
>
>
>_______________________________________________
rules-users mailing list rules-users(a)lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
11 years, 10 months
Anyone Using Scorecards in a Spreadsheet?
by Steven Núñez
Hello Droolers,
Is anyone out there using scorecard spreadsheets? I'm trying to, ideally, import a PMML scorecard model, but in lieu of that can export a spreadsheet from the modeling tool and massage that. Trouble is I can't find anything in the 5.5 docos that describe the format that the spreadsheet is supposed to be in.
Does anyone have any pointers to the scorecard spreadsheet format?
Regards,
- SteveN
11 years, 10 months
Re: [rules-users] Bomb when calling Drools with PKG containing a process
by David Shields OpenCDS
Problem resolved. I inadvertently left a Maven Dependency pointing to jBPM
5.3 instead of 5.4.
From: David Shields OpenCDS [mailto:david.shields@opencds.org]
Sent: Tuesday, January 08, 2013 7:42 AM
To: rules-users(a)lists.jboss.org
Subject: Bomb when calling Drools with PKG containing a process
I have been trying to upgrade our application to Drools 5.5 from Drools 5.4.
I rebuilt several knowledgeBases containing processes with Drools 5.5, but I
can't get them to run. I can get a simple DRL file that does not reference
any processes to run just fine. Both the DRL and the KBs use
statelessSessions. The program has been used for a couple years, and has
been modified to run with Drools 5.1.1, 5.3, 5.4, and now 5.5, and has been
supporting processes since Drools 5.3 / jBPM 5.2.
Here is the bomb that I get:
OpenCDS call to Drools.execute failed with error: Unexpected exception
executing action
org.jbpm.process.instance.event.DefaultSignalManager$SignalAction@5cd5a2a9
org.drools.common.AbstractWorkingMemory:executeQueuedActions:995
org.drools.common.DefaultAgenda:fireNextItem:1239
org.drools.common.DefaultAgenda:fireAllRules:1456
org.drools.common.AbstractWorkingMemory:fireAllRules:710
org.drools.common.AbstractWorkingMemory:fireAllRules:674
org.drools.impl.StatefulKnowledgeSessionImpl:fireAllRules:230
org.drools.impl.StatelessKnowledgeSessionImpl:execute:278
org.opencds.service.drools.v55.DroolsAdapter:getOneResponse:370
org.opencds.dss.evaluate.EvaluationImpl:evaluate:169
org.opencds.service.TestEvaluationImpl:main:156
org.omg.dss.DSSRuntimeExceptionFault: OpenCDS call to Drools.execute failed
with error: Unexpected exception executing action
org.jbpm.process.instance.event.DefaultSignalManager$SignalAction@5cd5a2a9
executeQueuedActions
fireNextItem
fireAllRules
fireAllRules
fireAllRules
fireAllRules
execute
getOneResponse
evaluate
main
I have single-stepped through the code with Eclipse, but I can't quite
figure out what is wrong with my KBs. They ran just fine on Drools 5.4
(although there was a memory leak in Drools with that version), and the only
thing I changed was to populate the "probability" value on the BPMN-Diagram
(because it wouldn't validate without it).
The program builds a command list, and executes it with the following:
ExecutionResults results = null;
try {
results =
statelessKnowledgeSession.execute(CommandFactory.newBatchExecution((cmds)));
} catch (Exception e) {
String err = "OpenCDS call to Drools.execute failed with error:
" + e.getMessage();
log.error(err);
StackTraceElement elements[] = e.getStackTrace();
for (int i = 0, n = elements.length; i < n; i++) {
String detail = elements[i].getClassName() + ":" +
elements[i].getMethodName() + ":" + elements[i].getLineNumber();
log.error(detail);
err += "\n" + elements[i].getMethodName();
}
throw new DSSRuntimeExceptionFault(err);
}
Has anybody seen this error before?
Thanks for any ideas or suggestions!
-- des
11 years, 10 months
Stateless session dis-associating listeners after first execute call. Bug or a feature?
by Michal Bali
Hello,
I am using a stateless session. First I add an agenda event listener. When
I first call session.execute(Itelable) all works as expected. However when
I call it the second time (without adding the listener again) the listener
does not seem to be called at all.
However note that when I call session.getAgendaEventListeners() the event
listener is always there.
IMHO I am guessing that the 'dispose' method that is called behind the
scenes possibly dis-associates the event listener.
I've tested this with 5.5.Final. BTW This worked fine with Drools 5.0. I
haven't checked later versions.
I wonder is this a bug or a feature?
Isolated test case is attached.
Thank you.
Best regards,
Michal
11 years, 10 months
proble with localSearch
by Michiel Vermandel
Hi,
I'm trying to implement a basic local search (really new to it).
When I run my project I now get:
Exception in thread "main" java.lang.IllegalStateException: Phase localSearch started with an uninitialized Solution. First initialize the Solution. For example, run a phase constructionHeuristic first.
at org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.phaseStarted(DefaultLocalSearchSolverPhase.java:120)
This is my config:
<?xml version="1.0" encoding="UTF-8"?>
<solver>
<environmentMode>DEBUG</environmentMode>
<!-- Domain model configuration -->
<solutionClass>be.axi.planner.app.InspectionSchedule</solutionClass>
<planningEntityClass>be.axi.planner.domain.Task</planningEntityClass>
<!-- Score configuration -->
<scoreDirectorFactory>
<scoreDefinitionType>HARD_AND_SOFT</scoreDefinitionType>
<scoreDrl>/inspectionRules.drl</scoreDrl>
</scoreDirectorFactory>
<constructionHeuristic>
<constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType>
<!-- constructionHeuristicPickEarlyType>FIRST_LAST_STEP_SCORE_EQUAL_OR_IMPROVING</constructionHeuristicPickEarlyType-->
</constructionHeuristic>
<localSearch>
<termination>
<terminationCompositionStyle>OR</terminationCompositionStyle>
<maximumSecondsSpend>3600</maximumSecondsSpend>
<scoreAttained>0hard/0soft</scoreAttained>
</termination>
<unionMoveSelector>
<changeMoveSelector>
<valueSelector>
<planningVariableName>period</planningVariableName>
</valueSelector>
</changeMoveSelector>
<changeMoveSelector>
<valueSelector>
<planningVariableName>spector</planningVariableName>
</valueSelector>
</changeMoveSelector>
<changeMoveSelector>
<valueSelector>
<planningVariableName>type</planningVariableName>
</valueSelector>
</changeMoveSelector>
<swapMoveSelector>
</swapMoveSelector>
</unionMoveSelector>
<acceptor>
<planningEntityTabuSize>7</planningEntityTabuSize>
</acceptor>
<forager>
<minimalAcceptedSelection>1000</minimalAcceptedSelection>
</forager>
</localSearch>
</solver>
Any thoughts on what I'm doing wrong?
Thanks
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
11 years, 10 months
Bomb when calling Drools with PKG containing a process
by David Shields OpenCDS
I have been trying to upgrade our application to Drools 5.5 from Drools 5.4.
I rebuilt several knowledgeBases containing processes with Drools 5.5, but I
can't get them to run. I can get a simple DRL file that does not reference
any processes to run just fine. Both the DRL and the KBs use
statelessSessions. The program has been used for a couple years, and has
been modified to run with Drools 5.1.1, 5.3, 5.4, and now 5.5, and has been
supporting processes since Drools 5.3 / jBPM 5.2.
Here is the bomb that I get:
OpenCDS call to Drools.execute failed with error: Unexpected exception
executing action
org.jbpm.process.instance.event.DefaultSignalManager$SignalAction@5cd5a2a9
org.drools.common.AbstractWorkingMemory:executeQueuedActions:995
org.drools.common.DefaultAgenda:fireNextItem:1239
org.drools.common.DefaultAgenda:fireAllRules:1456
org.drools.common.AbstractWorkingMemory:fireAllRules:710
org.drools.common.AbstractWorkingMemory:fireAllRules:674
org.drools.impl.StatefulKnowledgeSessionImpl:fireAllRules:230
org.drools.impl.StatelessKnowledgeSessionImpl:execute:278
org.opencds.service.drools.v55.DroolsAdapter:getOneResponse:370
org.opencds.dss.evaluate.EvaluationImpl:evaluate:169
org.opencds.service.TestEvaluationImpl:main:156
org.omg.dss.DSSRuntimeExceptionFault: OpenCDS call to Drools.execute failed
with error: Unexpected exception executing action
org.jbpm.process.instance.event.DefaultSignalManager$SignalAction@5cd5a2a9
executeQueuedActions
fireNextItem
fireAllRules
fireAllRules
fireAllRules
fireAllRules
execute
getOneResponse
evaluate
main
I have single-stepped through the code with Eclipse, but I can't quite
figure out what is wrong with my KBs. They ran just fine on Drools 5.4
(although there was a memory leak in Drools with that version), and the only
thing I changed was to populate the "probability" value on the BPMN-Diagram
(because it wouldn't validate without it).
The program builds a command list, and executes it with the following:
ExecutionResults results = null;
try {
results =
statelessKnowledgeSession.execute(CommandFactory.newBatchExecution((cmds)));
} catch (Exception e) {
String err = "OpenCDS call to Drools.execute failed with error:
" + e.getMessage();
log.error(err);
StackTraceElement elements[] = e.getStackTrace();
for (int i = 0, n = elements.length; i < n; i++) {
String detail = elements[i].getClassName() + ":" +
elements[i].getMethodName() + ":" + elements[i].getLineNumber();
log.error(detail);
err += "\n" + elements[i].getMethodName();
}
throw new DSSRuntimeExceptionFault(err);
}
Has anybody seen this error before?
Thanks for any ideas or suggestions!
-- des
11 years, 10 months
Drools has some exception when running jboss-as7/jboss-eap6 in clustered mode
by Nurlan
Hi, guys!
I'm using drools-5.4.0.Final in web project;
When I start jboss-eap-6.0.1 in clustered mode it shows this exception in
logs:
Any suggestions or hints to fix this error/exception?
17:25:58,132 ERROR [org.infinispan.transaction.TransactionCoordinator]
(http-/127.0.0.1:8080-4) ISPN000097: Error while processing a prepare in a
single-phase transaction: org.infinispan.CacheException:
java.lang.NoClassDefFoundError: com/google/protobuf/Message
at
org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:171)
at
org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:183)
at
org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:240)
at
org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:227)
at
org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:222)
at
org.infinispan.remoting.rpc.RpcManagerImpl.broadcastRpcCommand(RpcManagerImpl.java:201)
at
org.infinispan.interceptors.ReplicationInterceptor.broadcastPrepare(ReplicationInterceptor.java:136)
at
org.infinispan.interceptors.ReplicationInterceptor.visitPrepareCommand(ReplicationInterceptor.java:128)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:130)
at
org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:126)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:130)
at
org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:126)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.EntryWrappingInterceptor.visitPrepareCommand(EntryWrappingInterceptor.java:93)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.invokeNextAndCommitIf1Pc(AbstractTxLockingInterceptor.java:120)
at
org.infinispan.interceptors.locking.OptimisticLockingInterceptor.visitPrepareCommand(OptimisticLockingInterceptor.java:131)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.NotificationInterceptor.visitPrepareCommand(NotificationInterceptor.java:58)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.TxInterceptor.visitPrepareCommand(TxInterceptor.java:106)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.StateTransferLockInterceptor.handleWithRetries(StateTransferLockInterceptor.java:213)
at
org.infinispan.interceptors.StateTransferLockInterceptor.visitPrepareCommand(StateTransferLockInterceptor.java:85)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:130)
at
org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:126)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:132)
at
org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:91)
at
org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:126)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at
org.infinispan.interceptors.BatchingInterceptor.handleDefault(BatchingInterceptor.java:86)
at
org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:126)
at
org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:133)
at
org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:345)
at
org.infinispan.transaction.TransactionCoordinator.commit(TransactionCoordinator.java:174)
at
org.infinispan.transaction.synchronization.SynchronizationAdapter.afterCompletion(SynchronizationAdapter.java:81)
at
org.infinispan.transaction.tm.DummyTransaction.notifyAfterCompletion(DummyTransaction.java:285)
at
org.infinispan.transaction.tm.DummyTransaction.runCommitTx(DummyTransaction.java:334)
at
org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:91)
at
org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:102)
at
org.jboss.as.clustering.web.impl.TransactionBatchingManager.endBatch(TransactionBatchingManager.java:75)
at
org.jboss.as.web.session.DistributableSessionManager.processSessionRepl(DistributableSessionManager.java:1515)
[jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]
at
org.jboss.as.web.session.DistributableSessionManager.storeSession(DistributableSessionManager.java:857)
[jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]
at
org.jboss.as.web.session.InstantSnapshotManager.snapshot(InstantSnapshotManager.java:47)
[jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]
at
org.jboss.as.web.session.ClusteredSessionValve.handleRequest(ClusteredSessionValve.java:142)
[jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]
at
org.jboss.as.web.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:99)
[jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]
at org.jboss.as.web.session.JvmRouteValve.invoke(JvmRouteValve.java:92)
[jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]
at org.jboss.as.web.session.LockingValve.invoke(LockingValve.java:64)
[jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489)
[jbossweb-7.0.17.Final-redhat-1.jar:]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
[jboss-as-web-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[jbossweb-7.0.17.Final-redhat-1.jar:]
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.17.Final-redhat-1.jar:]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.17.Final-redhat-1.jar:]
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
[jbossweb-7.0.17.Final-redhat-1.jar:]
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[jbossweb-7.0.17.Final-redhat-1.jar:]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679)
[jbossweb-7.0.17.Final-redhat-1.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)
[jbossweb-7.0.17.Final-redhat-1.jar:]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_35]
Caused by: java.lang.NoClassDefFoundError: com/google/protobuf/Message
at
org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:169)
[drools-core-5.4.0.Final.jar:5.4.0.Final]
at
org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:151)
[drools-core-5.4.0.Final.jar:5.4.0.Final]
at
org.drools.reteoo.ReteooStatefulSession.writeExternal(ReteooStatefulSession.java:117)
[drools-core-5.4.0.Final.jar:5.4.0.Final]
at
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:873)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:680)
at
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
at
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
at
org.jboss.as.clustering.SimpleMarshalledValue.getBytes(SimpleMarshalledValue.java:85)
at
org.jboss.as.clustering.SimpleMarshalledValue.writeExternal(SimpleMarshalledValue.java:175)
at
org.jboss.as.clustering.infinispan.io.ExternalizableExternalizer.writeObject(ExternalizableExternalizer.java:46)
at
org.jboss.as.clustering.infinispan.io.ExternalizableExternalizer.writeObject(ExternalizableExternalizer.java:36)
at
org.infinispan.marshall.jboss.ExternalizerTable$ForeignExternalizerAdapter.writeObject(ExternalizerTable.java:450)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:145)
at
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
at
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
at
org.infinispan.atomic.PutOperation$Externalizer.writeObject(PutOperation.java:80)
at
org.infinispan.atomic.PutOperation$Externalizer.writeObject(PutOperation.java:76)
at
org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:401)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:145)
at
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
at
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
at
org.infinispan.marshall.MarshallUtil.marshallCollection(MarshallUtil.java:48)
at
org.infinispan.marshall.exts.LinkedListExternalizer.writeObject(LinkedListExternalizer.java:50)
at
org.infinispan.marshall.exts.LinkedListExternalizer.writeObject(LinkedListExternalizer.java:45)
at
org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:401)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:145)
at
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
at
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
at
org.infinispan.atomic.AtomicHashMapDelta$Externalizer.writeObject(AtomicHashMapDelta.java:110)
at
org.infinispan.atomic.AtomicHashMapDelta$Externalizer.writeObject(AtomicHashMapDelta.java:106)
at
org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:401)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:145)
at
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
at
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
at
org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:83)
at
org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:70)
at
org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:58)
at
org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:401)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:145)
at
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
at
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
at
org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:85)
at
org.infinispan.marshall.exts.CacheRpcCommandExternalizer.marshallParameters(CacheRpcCommandExternalizer.java:124)
at
org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:111)
at
org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:66)
at
org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:401)
at
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:145)
at
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
at
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
at
org.infinispan.marshall.jboss.AbstractJBossMarshaller.objectToObjectStream(AbstractJBossMarshaller.java:96)
at
org.infinispan.marshall.VersionAwareMarshaller.objectToBuffer(VersionAwareMarshaller.java:91)
at
org.infinispan.marshall.AbstractMarshaller.objectToBuffer(AbstractMarshaller.java:64)
at
org.infinispan.marshall.AbstractDelegatingMarshaller.objectToBuffer(AbstractDelegatingMarshaller.java:109)
at
org.infinispan.remoting.transport.jgroups.MarshallerAdapter.objectToBuffer(MarshallerAdapter.java:45)
at
org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:255)
at
org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.processSingleCall(CommandAwareRpcDispatcher.java:274)
at
org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:165)
at
org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:489)
at
org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:161)
... 71 more
Caused by: java.lang.ClassNotFoundException: com.google.protobuf.Message
from [Module "deployment.sms.war:main" from Service Module Loader]
at
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 133 more
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-has-some-exception-when-running-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Checking whether an element exists as well doesnt exists in several lists
by devan.vanreenen@gmail.com
Hi there,
Please assist
I have an several alert objects in working memory which have been logically
collected per case number using the following rule,
rule 'Group alerts for a specific case'
dialect 'java'
when
Alert( $caseNumber : caseNumber, $alertNo: alertNo )
not Alert( caseNumber == $caseNumber, alertNo < $alertNo )
$list : List( ) from collect($alert : Alert( caseNumber ==
$caseNumber))
then
System.out.println("******Printing list******: ");
System.out.println("******List hashCode: " + $list.hashCode());
for(Object o : $list){
System.out.println(o);
}
I then declare a fact CaseList with a property with name value and type
List, each time a new List is collected, I create a new CaseList and set
this list on this intance and logically insert this intance
CaseList caseList = new CaseList();
caseList.setValue($list);
insertLogical(caseList);
end
Sample output
******Printing list******:
******List hashCode: 342532614
Alert [caseNumber=1022621, alertNo=6]
Alert [caseNumber=1022621, alertNo=6]
Alert [caseNumber=1022621, alertNo=6]
Alert [caseNumber=1022621, alertNo=2]
Alert [caseNumber=1022621, alertNo=1]
Alert [caseNumber=1022621, alertNo=2]
Alert [caseNumber=1022621, alertNo=2]
Alert [caseNumber=1022621, alertNo=8]
******Printing list******:
******List hashCode: 890817600
Alert [caseNumber=1021567, alertNo=1]
Alert [caseNumber=1021567, alertNo=2]
Alert [caseNumber=1021567, alertNo=8]
******Printing list******:
******List hashCode: -1376001294
Alert [caseNumber=1012283, alertNo=1]
Alert [caseNumber=1012283, alertNo=2]
Alert [caseNumber=1012283, alertNo=6]
Alert [caseNumber=1012283, alertNo=2]
Alert [caseNumber=1012283, alertNo=8]
Alert [caseNumber=1012283, alertNo=2]
******Printing list******:
******List hashCode: -1069600305
Alert [caseNumber=55506677, alertNo=1]
Alert [caseNumber=55506677, alertNo=2]
Alert [caseNumber=55506677, alertNo=6]
I then have a different rule that checks for any CaseList objects in working
memory and needs to interrogate each instance and collected list to see
whether the list contains an alert with alertNo == 4 or 5 or 6 and does not
contain an alert with alertNo == 7 or == 8 and then creates a new inferred
fact HighPriority if this is the case which other rules act on.
I use the following rule to be able to do this logic and expect a single
HighPriority intance in working memory but there are several, am I doing it
wrong,
rule 'Determine if High priority'
dialect 'java'
when
$a1 : Alert( alertNo == 4 || == 5 || == 6 )
$a2 : Alert( alertNo == 7 || == 8 )
$m : CaseList( value contains $a1 && not contains $a2 )
then
HighPriority hp = new HighPriority();
hp.setValue(true);
insertLogical(hp);
end
--
View this message in context: http://drools.46999.n3.nabble.com/Checking-whether-an-element-exists-as-w...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months