Hi all,
I am having a hard time configuring the spring-modules jbpmTemplate. I am using Spring ver. 2.5.6.
When I execute the following code:
I get :Code:jbpmTemplate.execute(new JbpmCallback() { public Object doInJbpm(JbpmContext context) { GraphSession gSession = context.getGraphSession(); gSession.saveProcessDefinition(jbpmTemplate.getProcessDefinition()); ... ProcessInstance processInstance = context.newProcessInstanceForUpdate("x"); ContextInstance contextInstance = processInstance.getContextInstance(); ... context.save(processInstance); ... return null; // I get the error after this line is executed } });
my jbpm.cfg.xml contains:Code:org.hibernate.SessionException: Session is closed! at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:72) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:558) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546) 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:592) at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1293) at $Proxy99.save(Unknown Source) at org.jbpm.svc.save.HibernateSaveOperation.save(HibernateSaveOperation.java:38) at org.jbpm.svc.Services.save(Services.java:173) at org.jbpm.JbpmContext.save(JbpmContext.java:461) at org.jbpm.JbpmContext.autoSave(JbpmContext.java:691) at org.jbpm.JbpmContext.close(JbpmContext.java:129) at org.springmodules.workflow.jbpm31.JbpmTemplate.releaseContext(JbpmTemplate.java:110) at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:99) at com.curo.webapp.action.ManagerSubmitAction.submit(ManagerSubmitAction.java:139)
and my application context contains:Code:<jbpm-configuration> <jbpm-context> <service name="persistence"> <factory> <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory"> <field name="isTransactionEnabled"><false /></field> </bean> </factory> </service> <service name="tx" factory="org.jbpm.tx.TxServiceFactory"/> </jbpm-context>
I guess both spring module and jbpm context are trying to close the session. Would you please help me to understand why am I getting this error?Code:<bean id="jbpmSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" autowire-candidate="false" name="jbpmSessionFactory"> <property name="dataSource" ref="jbpmDataSource" /> <property name="configLocation" value="classpath:hibernate.jbpm.cfg.xml" /> .... <bean id="jbpmDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName}"/> <property name="url" value="${jdbc.jbpm.url}"/> </bean> ... <bean id="processDefinition" class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean"> <property name="definitionLocation" value="classpath:processdefinition.xml"></property> </bean> <bean id="jbpmConfiguration" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean"> <property name="sessionFactory" ref="jbpmSessionFactory"></property> <property name="configuration" value="classpath:jbpm.cfg.xml" /> <property name="createSchema" value="false" /> <property name="processDefinitions"> <list> <ref local="processDefinition"></ref> </list> </property> <property name="processDefinitionsResources"> <list> <value>classpath:reportee.processdefinition.xml</value> </list> </property> </bean> <bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTemplate" > <constructor-arg index="0" ref="jbpmConfiguration" /> <constructor-arg index="1" ref="processDefinition"/> </bean> ...


