Re: [rules-users] rules-users Digest, Vol 48, Issue 89
by Shivram kalwar
Hello All ,
I have 2 question on drools 5.1 ,I am using the Tomcat server,
1)where can i see the drools file(.drl) converted into .java file, I mean
internally drools convert the .drl into .java and uses the .java at runtime
?
2) suppose in drools when condition it has many statements so how the logic
works for then condition ..
i Have statement in when for some object the working memory got modified for
some it is not and there are many conditional statements(true or flase) are
there on multiple Object(like Parts ,Discount, etc)
Thank you very much for you guideline in advance.
shiv
15 years, 7 months
5.2.0-SNAPSHOT java.io.OptionalDataException
by mjhn
Hi,
I'm using the 5.2.0-SNAPSHOT binaries for making use of the new auth
attributes in the kagent:resource tag.
I'm attempting to get PKG out of Guvnor. Using the following
droolsservice.xml config
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:drools="http://drools.org/schema/drools-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://drools.org/schema/drools-spring
http://192.168.2.2/~martinjohnson/xmpp_code/drools-spring-1.2.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd" >
<drools:kagent kbase="knowledgeBase" id="kagent" new-instance="false">
<drools:resources>
<drools:resource type="CHANGE_SET"
basic-authentication="enabled" username="admin" password=""
source="http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/..."
/>
</drools:resources>
</drools:kagent>
</beans>
As far as i can tell the ChangeSet.xml is coming down. The PKG accessed.
Though then...
Nov 25, 2010 9:09:52 PM com.javawhat.rules.RuleAgentManager init
INFO: Loading knowledge agents ...
Nov 25, 2010 9:09:52 PM com.javawhat.rules.RuleAgentManager init
INFO: Initializing knowledge agents with package:
[2010:11:329 21:11:675:info] ResourceChangeScanner reconfigured with
interval=60
[2010:11:329 21:11:676:info] ResourceChangeScanner created with default
interval=60
[2010:11:329 21:11:682:info] ResourceChangeScanner reconfigured with
interval=120
[2010:11:329 21:11:682:info] ResourceChangeScanner reconfigured with
interval=120
[2010:11:329 21:11:14:info] ResourceChangeNotification created
[2010:11:329 21:11:14:debug] ResourceChangeNotification monitor added
monitor=org.drools.io.impl.ResourceChangeScannerImpl@37722456
[2010:11:329 21:11:17:debug] KnowledgeAgent building resource map
[2010:11:329 21:11:17:info] KnowledegAgent has started listening for
ChangeSet notifications
[2010:11:329 21:11:18:info] KnowledgeAgent created, with configuration:
monitorChangeSetEvents=true scanResources=true scanDirectories=true
newInstance=false
[2010:11:329 21:11:514:info] KnowledgeAgent applying ChangeSet
[2010:11:329 21:11:516:debug] KnowledgeAgent notifier subscribing to
resource=[UrlResource
path='http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/...']
[2010:11:329 21:11:516:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@23000bcf to
resource=[UrlResource
path='http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/...']
[2010:11:329 21:11:516:debug] ResourceChangeScanner subcribing
notifier=org.drools.io.impl.ResourceChangeNotifierImpl@580754fc to
resource=[UrlResource
path='http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/...']
[2010:11:329 21:11:517:debug] KnowledgeAgent rebuilding KnowledgeBase using
ChangeSet
[2010:11:329 21:11:517:info] KnowledgeAgent performing an incremental build
of the ChangeSet
[2010:11:329 21:11:280:exception]
java.lang.RuntimeException: KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:665)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:618)
at
org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:809)
at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:587)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:186)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:169)
at
com.javawhat.rules.RuleAgentManager.createKnowledgeAgent(RuleAgentManager.java:125)
at com.javawhat.rules.RuleAgentManager.init(RuleAgentManager.java:85)
at
com.javawhat.rules.RuleAgentManager.getInstance(RuleAgentManager.java:48)
at com.adstream.test.Main.main(Main.java:53)
Caused by: java.io.OptionalDataException
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1282)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at
org.drools.rule.JavaDialectRuntimeData.readExternal(JavaDialectRuntimeData.java:167)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at java.util.HashMap.readObject(HashMap.java:1030)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at
org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:59)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at org.drools.rule.Package.readExternal(Package.java:197)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:205)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:174)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:654)
... 9 more
[2010:11:329 21:11:283:warning] KnowledgeAgent: The resource didn't create
any package: [UrlResource
path='http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/...']
[2010:11:329 21:11:283:info] KnowledgeAgent incremental build of
KnowledgeBase finished and in use
[2010:11:329 21:11:284:debug] KnowledgeAgent finished rebuilding
KnowledgeBase using ChangeSet
The issue lies behind 'stream.readObject();' from JavaDialectRuntimeData
around line 167
// Return the object stored as a byte[]
byte[] bytes = (byte[]) stream.readObject();
if ( signed ) {
checkSignature( stream,
helper,
bytes,
pubKeyAlias );
}
guvnor and my sample app are both running 5.2.0-SNAPSHOT. Really appreciate
any advice. Is it falling over an a parse of the binary and some
disagreement on contents of payload?
Thanks
Martin
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/5-2-0-SNAPSHOT-java-i...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
Temporal constraint not causing rule activation when using StatefulKnowledgeSession.update()
by Nathan Bell
To demonstrate the issue I have simplified the following sample rule to
just the components needed to demonstrate the issue. The example rule
I'm posting here uses the "after" operator; I have also tried this same
test with the before operator. In this sample the rule named "AfterRule"
will activate if the facts are initially inserted in a state matching
the pattern. However, if the facts are inserted in a state that does not
match, and then later updated to match the pattern using
StatefulKnowledgeSession.update() the rule will not activate.
Consider the following DRL:
package test.rules;
dialect "java"
import java.util.Date;
import com.p1s.mps.model.RuleTime;
import com.p1s.mps.model.Patient;
declare RuleTime
@role( event )
@timestamp( time )
end
declare Patient
@role( event )
@timestamp( birthDate )
end
rule "AfterRule"
when
$now : RuleTime( )
Patient( this after $now )
then
System.out.println("after");
end
Separately in a unit test the following actions are performed:
1. Insert an instance of RuleTime into the session where time is
set to now.
2. Insert an instance of a patient into the session where the
birthdate is set to (now - 1 day). [This makes the birthdate in the past
so the rule does not activate]
3. Call fireAllRules(). The rule does not activate, as expected.
4. Modify the patient instance to have a birthdate set to (now + 1
day).
5. Invoke update() on knowledge session.
6. Call fireAllRules(). The rules does not activate. It should
activate here.
If I change step 5 to a retract + insert then the rule will activate in
step 6 as expected.
Thank You,
Nathan Bell
15 years, 7 months
Rules trace questions
by Anais Martinez
Hello.
I'm trying to get the rules trace in execution by using
WorkingMemoryFileLogger. I am using the Hello word example, and I call the
WorkingMemoryFileLogger.wirteToDisk() in the RHS of rules. My modified drl
file is:
import com.sample.DroolsTest.Message;
global org.drools.audit.WorkingMemoryFileLogger rulesLogger
declare Output
@role (event)
end
rule "Hello World"
when
m : Message( status == Message.HELLO, myMessage : message )
then
System.out.println( myMessage + ": Hello message" );
m.setMessage( myMessage );
m.setStatus( Message.GOODBYE );
update( m );
end
rule "GoodBye"
when
Message( status == Message.GOODBYE, myMessage : message )
then
System.out.println( myMessage + ": Goodbye message" );
Output o= new Output();
insert(s);
end
rule "log trace"
when
o:Output( )
then
System.out.println("Loggin trace");
rulesLogger.writeToDisk();
end
I have filtered the logger to see only LogEvent.ACTIVATION_CREATED, and I
set the global rulesLogger in Main(). If I insert 2 messages, 2 "event.log"
files and one "test.log" appears. I have several questions (sorry if I say
nonsense):
First. How do I read the trace for each fire of "rule to log trace"? I mean,
the trace for "rule to log trace" is written forward (from event
insertion/updating/removing to "log trace" activation) or backward (from
"log trace" activation to event insertion/updating/removing)?
Second. Each event.log appears in each "log trace" activation because I am
writing the trace in the RHS. Am I right? Can I use that in order to read
the trace for each individual activation of "log trace"?
Third. I only allow LogEvent.ACTIVATION_CREATED, but some ObjectLogEvent
appear in the test.log file, but not in the event.log files. Why?
Thanks in advance.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-trace-questions...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
[Flow] Waiting for certain Event based on Event-Data
by Gregor Ryba
Hi,
i've got multiple workitems, i want to process via my workflow
so i'm starting my workflow once with every workitem passed as variable (so they are running simultaneously)
in the workflow i sometimes have to wait for an event to occur - but such an event is only linked to one of the workitems
i added an (Message) Event Node followed by a Join so the process Blocks
class Event{
string ItemId;
}
after receiving the event i could check if the ItemId equals the one of the workitem, but if that's not the case i would have
to go one step back and AGAIN listen for the event.
can i somehow make a loop or anything else, so the process blocks until an Event with the right ItemId occurs?
regards
15 years, 7 months
Cannot synchronize database state with session
by darren.kay@bt.com
Drools Version: 5.1.0
JBoss Version: 5.1.0 GA (Clustered)
We're using a clustered JBoss setup (with 2 nodes) with Drools and getting an intermittent stale ksession exception - stack trace attached below.
We use 'org.drools.persistence.jpa.JPAKnowledgeService' to persist KnowledgeSession to a MySQL database and use Hibernate to manage the transactions.
In case of a new request, we create a new Drools Knowledge Session and persist it and store the knowledge session id to our database.
StatefulKnowledgeSession session = JPAKnowledgeService.newStatefulKnowledgeSession(knowledgeBase, null, environment);
return session;
For all subsequent requests we load the Knowledge session from the database using the knowledge session id.
StatefulKnowledgeSession session = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, knowledgeBase, null, environment);
return session;
We receive request from the front-end validate the information and update the knowledge session facts using;
public void insertOrUpdateSessionFacts(StatefulKnowledgeSession session, Object...objects) {
boolean factMatched = false;
for (Object obj: objects) {
//get all session facts
Collection<Object> facts = session.getObjects();
for (Object fact: facts) {
if (fact.getClass().toString().equals(obj.getClass().toString())) {
//update fact in session
session.update(session.getFactHandle(fact), obj);
factMatched = true;
break;
}
}
if (factMatched) {
factMatched = false;
} else {
//fact not found, so insert new fact
session.insert(obj);
}
}
}
After the facts are updated we use find the response variable populated from the Drools flow and pass it back to the front-end;
//get variable scope context
VariableScopeInstance vi = (VariableScopeInstance) processInstance.getContextInstance(VariableScope.VARIABLE_SCOPE);
return vi.getVariable(variableName);
Any pointers would be much appreciated Stack Trace is below
Darren
-------------------------------------
2010-11-23 04:40:26,838 INFO [STDOUT] (pool-47-thread-1) Hibernate: select workitemin0_.workItemId as workItemId92_0_, workitemin0_.creationDate as creation2_92_0_, workitemin0_.externalVariables as external3_92_0_, workitemin0_.name as name92_0_, workitemin0_.processInstanceId as processI5_92_0_, workitemin0_.state as state92_0_, workitemin0_.OPTLOCK as OPTLOCK92_0_, workitemin0_.workItemByteArray as workItem8_92_0_ from WorkItemInfo workitemin0_ where workitemin0_.workItemId=?
2010-11-23 04:40:26,841 INFO [STDOUT] (pool-47-thread-1) Hibernate: select variables0_.workItemId as workItemId1_, variables0_.id as id1_, variables0_.name as formula1_1_, variables0_.id as id94_0_, variables0_.name as name94_0_, variables0_.persister as persister94_0_, variables0_.processInstanceId as processI5_94_0_, variables0_.workItemId as workItemId94_0_ from VariableInstanceInfo variables0_ where variables0_.workItemId=?
2010-11-23 04:40:26,857 INFO [STDOUT] (pool-47-thread-1) Hibernate: update ProcessInstanceInfo set externalVariables=?, lastModificationDate=?, lastReadDate=?, processId=?, processInstanceByteArray=?, startDate=?, state=?, OPTLOCK=? where InstanceId=? and OPTLOCK=?
2010-11-23 04:40:26,864 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] (pool-47-thread-1) Could not synchronize database state with session
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.drools.persistence.processinstance.ProcessInstanceInfo#14]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:504)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:269)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:89)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1423)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:137)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:170)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:261)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:85)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
at $Proxy608.invoke(Unknown Source)
at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
at $Proxy607.processKbdRequest(Unknown Source)
at net.plus.kbd.faults.gateway.actions.DroolsFlowSender.process(DroolsFlowSender.java:84)
at sun.reflect.GeneratedMethodAccessor807.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102)
at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.process(OverriddenActionLifecycleProcessor.java:74)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:649)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:603)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:433)
at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:540)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2010-11-23 04:40:26,871 WARN [com.arjuna.ats.arjuna.logging.arjLoggerI18N] (pool-47-thread-1) [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.beforeCompletion - failed for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@c9c803
javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.drools.persistence.processinstance.ProcessInstanceInfo#14]
at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:630)
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:588)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:513)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:269)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:89)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1423)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:137)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:170)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:261)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:85)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
at $Proxy608.invoke(Unknown Source)
at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
at $Proxy607.processKbdRequest(Unknown Source)
at net.plus.kbd.faults.gateway.actions.DroolsFlowSender.process(DroolsFlowSender.java:84)
at sun.reflect.GeneratedMethodAccessor807.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102)
at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.process(OverriddenActionLifecycleProcessor.java:74)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:649)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:603)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:433)
at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:540)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.drools.persistence.processinstance.ProcessInstanceInfo#14]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:504)
... 45 more
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
15 years, 7 months
Simple Drools Planner Example with NQueens
by morge
Hi all,
I am currently looking at Drools planner. I try to solve a simple 4 queens
problem with the following
code:
XmlSolverConfigurer configurer = new XmlSolverConfigurer();
configurer.configure("/org/drools/planner/myexamples/nqueens/app/nqueensSolverConfig.xml");
Solver solver = configurer.buildSolver();
NQueensGenerator generator=new NQueensGenerator();
Solution startingSolution = generator.createNQueens(4);
solver.setStartingSolution(startingSolution);
solver.solve();
Solution bestSolution = solver.getBestSolution();
System.out.println((NQueens) bestSolution);
The config file is the usual one:
<?xml version="1.0" encoding="UTF-8"?>
<localSearchSolver>
<environmentMode>DEBUG</environmentMode>
<scoreDrl>/org/drools/planner/examples/nqueens/solver/nQueensScoreRules.drl</scoreDrl>
<scoreDefinition>
<scoreDefinitionType>SIMPLE</scoreDefinitionType>
</scoreDefinition>
<!-- Real world problems require to use of
<startingSolutionInitializerClass>. -->
<termination>
<terminationCompositionStyle>OR</terminationCompositionStyle>
<maximumStepCount>100</maximumStepCount>
<scoreAttained>0</scoreAttained>
</termination>
<selector>
<moveFactoryClass>org.drools.planner.examples.nqueens.solver.move.factory.NQueensMoveFactory</moveFactoryClass>
</selector>
<acceptor>
<completeSolutionTabuSize>1000</completeSolutionTabuSize>
</acceptor>
<forager>
<pickEarlyType>NEVER</pickEarlyType>
<!-- Real world problems require to use of
<minimalAcceptedSelection> -->
</forager>
</localSearchSolver>
I do not understand why but it does not work:
2010-11-17 11:15:13,791 [main] INFO Solving with random seed (0).
2010-11-17 11:15:13,793 [main] INFO Initialization time spend (4) for score
(0). Updating best solution and best score.
Exception in thread "main" java.lang.ClassCastException:
org.drools.planner.myexamples.nqueens.domain.NQueens
at
org.drools.planner.examples.nqueens.solver.move.factory.NQueensMoveFactory.createCachedMoveList(NQueensMoveFactory.java:35)
at
org.drools.planner.core.move.factory.CachedMoveFactory.solvingStarted(CachedMoveFactory.java:39)
at
org.drools.planner.core.localsearch.decider.selector.MoveFactorySelector.solvingStarted(MoveFactorySelector.java:58)
at
org.drools.planner.core.localsearch.decider.DefaultDecider.solvingStarted(DefaultDecider.java:91)
at
org.drools.planner.core.localsearch.DefaultLocalSearchSolver.solvingStarted(DefaultLocalSearchSolver.java:188)
at
org.drools.planner.core.localsearch.DefaultLocalSearchSolver.solveImplementation(DefaultLocalSearchSolver.java:125)
at org.drools.planner.core.AbstractSolver.solve(AbstractSolver.java:57)
at org.drools.planner.myexamples.nqueens.app.Main.main(Main.java:32)
Any idea ?
Thanks in advance,
MM.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Simple-Drools-Planner...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
Doubt In Flow (HumanTask Persisting).
by Bennet Joseph
Hi All,
I am new to Drools, i have flow, (Start -> HumanTask_1 -> HumanTask_2 ->
Actions -> End)
when the flow starts it will goto Humantask_1,
I need to have workitemhandler for that particular human task(HumanTask_1) ,
how to achieve this.
then, i need to persist the state in DB(oracle), where to do this (i don't
have any idea regarding this).
in Drools Flow document they have given table names (ProcessInstanceLog and
NodeInstanceLog).
what type of column this table have.
when resuming, i need to start from the place where we persisted.
how to add actor and group to the humantask.
how to get response from the humantask, so that flow continues to next node.
when it goes from first human task to the second, is it possible to have
different workitemhandler for that.
and similar things of first humantask.
and i am trying all this things in command lime program, am i doing right,
if not please correct me.
Please help me.
thanks in advance.
Jose
15 years, 7 months