[rules-dev] Drools Flow Persisternce Stack Overflow Error

premkumar premkumar.sivanandan at gmail.com
Wed Oct 7 02:07:13 EDT 2009


Little insight about this project Timekeeper Management system where workflow
has timekeeper time sumbit, admin will send the time to speart Reviewer(S)
for verifcation as a sub process,  after verification from reviewers admin
aproves and move this to billing team.

There may "N" processInstance is running in memory and have to choose
apporpriate one.

In My rule condition am getting processInstance object am not sure with out
inserting to session the processinstance object not available to my rules

processInstance:WorkflowProcessInstance()  	-- This not reteriving when i am
insert the WorkflowProcessInstance into session	due to this my rule is
failing, but once i have inserted to session 
[session.insert(processInstance)] the rule is working fine.

This rule automattically triggered from drools Flow using RuleFlowGroup
node.

below the rule code snippet

rule "Active Live Request Check"  ruleflow-group "TK_Validate"
	dialect "java"
	when
		tkRequest:TKRequest (reqStatus == "Initiate")
		processInstance:WorkflowProcessInstance()  	
		tkRequestDAO:TKRequestDAO() 
	then 

                     // Do my custom operation, status change, persistence
upate

end

Thanks
Prem 


Mauricio Salatino wrote:
> 
> Hi, no problem.
> Basically you don't need to pass the ProcessInstance to the rules, because
> you can make inferences using the information inside the process instance
> in
> your rules.
> If you can share what you want to do in your rules, I can help you..
> Greetings
> 
> On Tue, Oct 6, 2009 at 8:31 AM, premkumar
> <premkumar.sivanandan at gmail.com>wrote:
> 
>>
>> Thanks Maurico on your response.  yes i am using bitronics .
>>
>>  I have identified why this error happens when i have insert
>> ProcessInstance
>> obect to session as a fact to made available them in drools rule file
>> conditions both LHS and RHS. Since the process instance is not implements
>> Serializable.
>>
>> Let me give details about me project tt is spring based web project with
>> hibernate .
>>
>> If you have any inputs how can i pass ProcessInstance object to Rules
>> when
>> am using JPAKnowledgeService.
>>
>>
>> Find the Persistence.xml below
>>
>>  <persistence-unit  name="org.drools.persistence.jpa"
>> transaction-type="JTA">
>>   <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>    <jta-data-source>processInstanceDS</jta-data-source>
>>    <class>org.drools.persistence.session.SessionInfo</class>
>>
>> <class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
>>
>>
>> <class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
>>    <class>org.drools.persistence.processinstance.WorkItemInfo</class>
>>
>>    <properties>
>>               <property name="hibernate.dialect"
>> value="org.hibernate.dialect.H2Dialect"/>
>>              <property name="hibernate.max_fetch_depth" value="3"/>
>>              <property name="hibernate.hbm2ddl.auto" value="update"/>
>>              <property name="hibernate.show_sql" value="true"/>
>>              <property name="hibernate.transaction.manager_lookup_class"
>>
>>  value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
>>     </properties>
>>  </persistence-unit>
>> </persistence>
>>
>> Datasource intialization code
>>
>> PoolingDataSource ds = new PoolingDataSource();
>>                ds.setUniqueName("processInstanceDS");
>>
>>                ds.setClassName("org.h2.jdbcx.JdbcDataSource");
>>                ds.setMaxPoolSize(3);
>>                ds.setAllowLocalTransactions(true);
>>                ds.getDriverProperties().put("user", "sa");
>>                ds.getDriverProperties().put("password", "sasa");
>>                ds.getDriverProperties().put("URL",
>> "jdbc:h2:file:/NotBackedUp/data/process-instance-db");
>>                ds.init()
>> Thanks
>> Prem
>>
>>
>> Mauricio Salatino wrote:
>> >
>> > are you using bitronix and an EJB3 container?
>> > can you explain us your infrastructure? what kind of projects do you
>> have,
>> > etc.
>> > Thanks!
>> >
>> > On Tue, Oct 6, 2009 at 2:18 AM, premkumar
>> > <premkumar.sivanandan at gmail.com>wrote:
>> >
>> >>
>> >> Hi
>> >>
>> >>     I am new to drools flow and trying to use the persistence using
>> >> JPAKnowledgeService. When i tried that got the stack overflow error in
>> H2
>> >> db.
>> >>
>> >>    Can any one provide the guidance how to resolve this.
>> >>
>> >> The exception trace is below
>> >>
>> >> Hibernate: insert into SessionInfo (id, dirty, lastModificationDate,
>> >> rulesByteArray, startDate) values (null, ?, ?, ?, ?)
>> >>  After the persistence Session @@@@@@
>> >> Oct 6, 2009 2:42:21 PM bitronix.tm.twopc.Preparer prepare
>> >> WARNING: executing transaction with 0 enlisted resource
>> >> Oct 6, 2009 2:42:21 PM bitronix.tm.twopc.Preparer prepare
>> >> WARNING: executing transaction with 0 enlisted resource
>> >> Oct 6, 2009 2:42:22 PM bitronix.tm.twopc.Preparer prepare
>> >> WARNING: executing transaction with 0 enlisted resource
>> >> Hibernate: insert into ProcessInstanceInfo (processInstanceId,
>> >> externalVariables, lastModificationDate, lastReadDate, processId,
>> >> processInstanceByteArray, startDate, state, OPTLOCK) values (null, ?,
>> ?,
>> >> ?,
>> >> ?, ?, ?, ?, ?)
>> >> Hibernate: insert into WorkItemInfo (workItemId, creationDate, name,
>> >> processInstanceId, state, OPTLOCK, workItemByteArray) values (null, ?,
>> ?,
>> >> ?,
>> >> ?, ?, ?)
>> >> Executing work item WorkItem 22 [name=Human Task, state=0,
>> >> processInstanceId=21, parameters{ActorId=Admin, Comment=Raise Tk
>> Request,
>> >> Skippable=false, TaskName=Raise Tk Request}]
>> >> Hibernate: update ProcessInstanceInfo set externalVariables=?,
>> >> lastModificationDate=?, lastReadDate=?, processId=?,
>> >> processInstanceByteArray=?, startDate=?, state=?, OPTLOCK=? where
>> >> processInstanceId=? and OPTLOCK=?
>> >> Hibernate: insert into ProcessInstanceInfo_eventTypes
>> >> (ProcessInstanceInfo_processInstanceId, element) values (?, ?)
>> >> Hibernate: delete from WorkItemInfo where workItemId=? and OPTLOCK=?
>> >> Hibernate: update SessionInfo set dirty=?, lastModificationDate=?,
>> >> rulesByteArray=?, startDate=? where id=?
>> >> ****** ut ******* a BitronixTransactionManager with 0 in-flight
>> >> transaction(s)
>> >> Oct 6, 2009 2:42:22 PM bitronix.tm.BitronixTransaction
>> >> fireBeforeCompletionEvent
>> >> WARNING: Synchronization.beforeCompletion() call failed for
>> >> org.hibernate.ejb.AbstractEntityManagerImpl$1 at 1824d2c, marking
>> >> transaction
>> >> as rollback only
>> >> javax.persistence.PersistenceException: java.lang.RuntimeException:
>> >> java.lang.StackOverflowError
>> >>        at
>> >>
>> >>
>> org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:516)
>> >>        at
>> >>
>> >>
>> bitronix.tm.BitronixTransaction.fireBeforeCompletionEvent(BitronixTransaction.java:366)
>> >>        at
>> >> bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:142)
>> >>        at
>> >>
>> >>
>> bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:96)
>> >>        at
>> >>
>> >>
>> org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:258)
>> >>        at
>> >>
>> >>
>> org.drools.command.impl.CommandBasedStatefulKnowledgeSession.insert(CommandBasedStatefulKnowledgeSession.java:305)
>> >>        at com.sample.POCTestClient.main(POCTestClient.java:57)
>> >> Caused by: java.lang.RuntimeException: java.lang.StackOverflowError
>> >>        at
>> >> org.hibernate.ejb.event.BeanCallback.invoke(BeanCallback.java:31)
>> >>        at
>> >>
>> >>
>> org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:80)
>> >>        at
>> >>
>> >>
>> org.hibernate.ejb.event.EntityCallbackHandler.preUpdate(EntityCallbackHandler.java:65)
>> >>        at
>> >>
>> >>
>> org.hibernate.ejb.event.EJB3FlushEntityEventListener.invokeInterceptor(EJB3FlushEntityEventListener.java:41)
>> >>        at
>> >>
>> >>
>> org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:330)
>> >>        at
>> >>
>> >>
>> org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:270)
>> >>        at
>> >>
>> >>
>> org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:151)
>> >>        at
>> >>
>> >>
>> org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
>> >>        at
>> >>
>> >>
>> org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
>> >>        at
>> >>
>> >>
>> org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)
>> >>        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)
>> >>        ... 6 more
>> >> Caused by: java.lang.StackOverflowError
>> >>
>> >> thanks
>> >> Prem
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Drools-Flow-Persisternce-Stack-Overflow-Error-tp25765337p25765337.html
>> >> Sent from the drools - dev mailing list archive at Nabble.com.
>> >>
>> >> _______________________________________________
>> >> rules-dev mailing list
>> >> rules-dev at lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/rules-dev
>> >>
>> >
>> >
>> >
>> > --
>> > - http://salaboy.wordpress.com
>> > - http://www.jbug.com.ar
>> > - Salatino "Salaboy" Mauricio -
>> >
>> > _______________________________________________
>> > rules-dev mailing list
>> > rules-dev at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-dev
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Drools-Flow-Persisternce-Stack-Overflow-Error-tp25765337p25771029.html
>> Sent from the drools - dev mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
> 
> 
> 
> -- 
> - http://salaboy.wordpress.com
> - http://www.jbug.com.ar
> - Salatino "Salaboy" Mauricio -
> 
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
> 
> 

-- 
View this message in context: http://www.nabble.com/Drools-Flow-Persisternce-Stack-Overflow-Error-tp25765337p25781020.html
Sent from the drools - dev mailing list archive at Nabble.com.



More information about the rules-dev mailing list