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
13 years, 2 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
13 years, 2 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
13 years, 2 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.
13 years, 2 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.
13 years, 2 months
Guvnor only: NullPointerException AfterEvaluator.evaluateCachedRight
by kappert
Version 5.5.0.Final (Guvnor and libraries)
We are seeing the NPE with the stack trace given below, but only when
loading rules through Guvnor. Same rules file and code runs fine without
Guvnor, but error with Guvnor.
*With Guvnor:* KnowlegdeBase from KnowledgeAgent using changeset.xml,
scanner running for on-the-fly rule updates in Guvnor.
*Without Guvnor:* kbuilder.add(new ClassPathResource("Rules.drl",
getClass()), ResourceType.DRL);
I have only little experience with Drools and would appreciate advice on how
to approach this problem.
Could it be something in the rules file itself?
But why would it make a difference whether the rules came from Guvnor or a
file?
Could the error point to something missing from the POJO model in Guvnor? I
am still in the process of determining what should go in the JAR file
exported from Eclipse and what not. The rules validate OK in Guvnor though,
and the package can be built.
What else to consider?
A similar problem was discussed here
<http://thread.gmane.org/gmane.comp.java.drools.user/15285> , but the
solution seems to have been an upgrade to version 5.
Unexpected exception caught: null
java.lang.NullPointerException
at
org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedRight(AfterEvaluatorDefinition.java:322)
at
org.drools.rule.constraint.EvaluatorConstraint.isAllowedCachedRight(EvaluatorConstraint.java:80)
at
org.drools.common.TripleBetaConstraints.isAllowedCachedRight(TripleBetaConstraints.java:101)
at org.drools.reteoo.JoinNode.propagateFromRight(JoinNode.java:156)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:148)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
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)
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-only-NullPointerException-AfterE...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
Purpose of difficultyWeightFactoryClass in @PlanningEntity annotation.
by Michiel Vermandel
Hi,
I am struggling with the purpose of difficultyWeightFactoryClass in the @PlanningEntity annotation.
I thought it was used to indicate which PlanningEntities to handle first in order to get faster to a solution.
Though it seems that it also has impact on whether or not to get to a zero-hardscore solution.
I mean I have a testcase that resolves to a zero-hardscore solution.
Then I change something small in how the difficultyWeightFactoryClass calculates the weight and all the sudden I get a negative-hardscore solution.
I thought it would still get to the same zero-hardscore solution but in a shorter solving time.
My solver termination is as follows:
<termination>
<terminationCompositionStyle>OR</terminationCompositionStyle>
<maximumSecondsSpend>3600</maximumSecondsSpend>
<scoreAttained>0hard/0soft</scoreAttained>
</termination>
and constructionHeuristic:
<constructionHeuristic>
<constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
I do not reach a zero-hardscore and the time spent is about 2.8 seconds...
If I read the best solution I get:
.isEveryProblemFactChangeProcessed(): true
.isTerminateEarly(): false
Any idea why I do not get a zero-hardscore solution anymore when only making a small change to the difficultyWeightFactoryClass logic?
Thanks
Michiel.
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years, 2 months
How do you use packages in Guvnor?
by dunnlow
I've been using Guvnor for a while (on v5.4) now. However, I've always had
everything in one "package." As my project grows however I am looking to
improve the organization of my assets - it is getting harder and harder for
me to find in Guvnor the rule I am looking for. As I looked into this it
occurred to me that I don't really understand the concept/purpose of a
package.
For example, I have a main package, "Auto" that contains generic
rules/assets for automobiles. I have assets specific to types of autos, so
I created packages "Auto.Compact" and "Auto.Sedan". Those packages are
created neatly under the Auto Package. However, when I looked at the source
for Auto, I expected to see the source for assets in Auto, Auto.Compact and
Auto.Sedan, but it only contains the source for Auto (rather than having
them rolled up).
I'm a java developer, so I expected the same sort of "package"
functionality; all of the sub packages being contained within the main
package.
FYI, I have a drools server that connects to Guvnor to obtain/create the
most recent rule base.
I have Drools Dev Cookbook, and looked through the online guide, but didn't
really find anything to help.
Can anyone explain to me the purpose/intention of a package (or point me to
some good documentation about it).
Any best practices out there on how to organize assets.
Thanks very much,
-J
--
View this message in context: http://drools.46999.n3.nabble.com/How-do-you-use-packages-in-Guvnor-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
Fwd: Retrieving constraints based on a manual solution
by Sreeni Maheshwaram
>
> Hi,
>
> Could you please advise:
>
> I am using the Drools Planner (5.5) to a) optimize the solution and get
> best
> solution b) allow the manual solution and resolve the conflicts, based on
> the business requirement.
>
> 1. scenario a is straight forward. I could run the solver, get the best
> solution, set it to the ScoreDirector as working solution, get the
> constraints from the working memory.
>
> 2. in scenario b, I do not want to run the solver for best solution. When I
> set the manual solution as a working solution on the ScoreDirector, I could
> not get the constraints.
>
> As a work around, either I have to run the solver in scenario b for some
> time to get the constraints, which I can not afford and I do not think the
> constraints relate to the manual solution.
>
> Is there a way to get cosntraints based on the manual solution without
> running the solver?
>
> regards,
> Sreeni
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Retrieving-constraints-based-on-a-manua...
> Sent from the Drools: User forum mailing list archive at Nabble.com.
>
>
--
Thanks, Sreeni M
--
Thanks, Sreeni M
13 years, 2 months
unmarshal global variable
by acormond
Gentlepeople,
I am fairly new to Drools and have what I hope is a simple question. I am
attempting to marshal (serialize) a Drools knowledge session and then
unmarshall it. The marshalling works but the unmarshalling fails with a
null pointer exception. The error is apparently with unmarshalling a global
variable in the session.
The session is created from a spreadsheet (decision table). This
spreadsheet
has two RuleTables. The first of these exists solely so that I can enter
some
constants into the session, specifically the name and price of the product
the
spreadsheet is dealing with. The second ruletable is where the rules are
specified. The exception occurs when unmarshalling the first rule in the
first
rule table. If, as a test, I eliminate the first rule table, then I can
successfully marshal and unmarshall the session.
The marshalling is done using the following, simplified, code:
Marshaller marshaller = MarshallerFactory.newMarshaller(kbase);
File droolsSessionFile = new File(MARSHAL_FILE);
foStream = new FileOutputStream(droolsSessionFile);
baos = new ByteArrayOutputStream();
marshaller.marshall(baos, ksession);
baos.writeTo(foStream);
and the unmarshalling is done like this:
Marshaller marshaller =
MarshallerFactory.newMarshaller(pricingProcessor.getKnowledgeBase());
FileInputStream fis = new FileInputStream(MARSHAL_FILE);
StatefulKnowledgeSession ksession = marshaller.unmarshall(fis);
So, where did I go wrong? Perhaps I need to deal with the global variable
differently, perhaps by putting it in the knowledgeBase before I unmarshall
the session?
Thank you for any help.
Alex Ormond
--
View this message in context: http://drools.46999.n3.nabble.com/unmarshal-global-variable-tp4021375.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months