[jboss-user] [jBPM Users] - Re: jbpm4 with spring PlatformTransactionManager problem

saraswati.santanu do-not-reply at jboss.com
Thu Nov 12 04:28:23 EST 2009


In that case I do not see a problem with your jbpm.cfg.xml file.

It seems you are using jbpm4.0 version. There the execute method of EnvironmentInterceptor looks a bit different from the later versions. However things should work even with that.

  |   public <T> T execute(Command<T> command) {
  |     Environment environment;
  |     
  |     if (command instanceof AbstractCommand) {
  |       AbstractCommand abstractCommand = (AbstractCommand) command;
  |       List<WireObject> txWireObjects = abstractCommand.getTxWireObjects();
  |       environment = environmentFactory.openEnvironment(txWireObjects);
  | 
  |     } else {
  |       environment = environmentFactory.openEnvironment();
  |     }
  |     
  |     try {
  |       return next.execute(command);
  |       
  |     } finally {
  |       environment.close();
  |     }
  |   }
  | 
When you are using Jbpm with spring environmentFactory is an instance of SpringConfiguration. And you can see that some version of openEnvironment will be called in any case. Once openEnvironment is called SpringConfiguration it calls

  | environment.setContext(new SpringContext(applicationContext));
  | 
Then when it searches for the bean that implements PlatformTransactionManager it should get one from the applicationContext passed. So just by looking at the code and you configuration I can not find any problem which can lead to this exception.

I have migrated to Jbpm4.2 and below is the configuration that I am using which works. Check if it helps

Spring configuration - along with the beans below I have SessionFactory bean also configured, but not given here

  |     <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  |         <property name="sessionFactory"><ref bean="sessionFactory"/></property>
  |         <property name="nestedTransactionAllowed"><value>true</value></property>
  |     </bean>
  | 
  |     <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  |         <property name="driverClass">
  |             <value>oracle.jdbc.driver.OracleDriver</value>
  |         </property>
  |         <property name="jdbcUrl">
  |             <value>jdbc:oracle:thin:@127.0.0.1:1521:xe</value>
  |         </property>
  |         <property name="properties">
  |             <props>
  |             <prop key="c3p0.acquire_increment">1</prop>
  |             <prop key="c3p0.idle_test_period">100</prop>
  |             <prop key="c3p0.max_size">100</prop>
  |             <prop key="c3p0.max_statements">0</prop>
  |             <prop key="c3p0.min_size">1</prop>
  |             <prop key="user">santanu</prop>
  |             <prop key="password">santanu</prop>
  |             </props>
  |         </property>
  |     </bean>
  | 
  | 	<bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
  | 		<constructor-arg value="jbpm/jbpm.cfg.xml" />
  | 	</bean>
  | 	
  | 	<bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
  | 	<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
  | 	<bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
  | 	<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
  | 	<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>
  | 	<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"/>
  | 

And jbpm config

  | <jbpm-configuration>
  |   <process-engine-context>
  |     <repository-service />
  |     <repository-cache />
  |     <execution-service />
  |     <history-service />
  |     <management-service />
  |     <task-service />
  |     <identity-service />
  |     <command-service name="txRequiredCommandService">
  |       <retry-interceptor />
  |       <environment-interceptor />
  |       <spring-transaction-interceptor/>
  |     </command-service>
  |     
  |     <hibernate-configuration>
  |       <cfg resource="jbpm.hibernate.cfg.xml" />     
  |     </hibernate-configuration>
  | 
  |     <object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator">
  |       <field name="commandService"><ref object="txRequiredCommandService" /></field>
  |     </object>
  | 
  |     <object class="org.jbpm.pvm.internal.id.DatabaseIdComposer" init="eager" />
  | 
  |     <deployer-manager>
  |       <jpdl-deployer />
  |     </deployer-manager>
  |     
  |     <script-manager default-expression-language="juel"
  |                     default-script-language="juel"
  |                     read-contexts="execution, environment, process-engine"
  |                     write-context="">
  |         <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
  |     </script-manager>
  |     <job-executor auto-start="false" />
  |     <types resource="jbpm.variable.types.xml" />
  |   </process-engine-context>
  | 
  |   <transaction-context>
  | 	<repository-session/>
  | 	<db-session/>
  | 	<message-session/>
  | 	<timer-session/>
  | 	<history-session/>
  | 	<hibernate-session current="true"/> 
  |   </transaction-context>
  | 
  | </jbpm-configuration>
  | 

It will be a bit difficult for me to move back to jbpm4.0 and try your config. So cant really debug your problem.


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265190#4265190

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265190



More information about the jboss-user mailing list