-
1. Re: JBPM5, Spring, BTM and Tomcat
calca Oct 11, 2011 4:31 PM (in response to snyperboss)Yes you should be able. Maybe this can help you
http://docs.codehaus.org/display/BTM/Spring+Framework2x
Demian
-
2. Re: JBPM5, Spring, BTM and Tomcat
snyperboss Oct 12, 2011 12:58 AM (in response to calca)After Googling for a while I came across this post.
http://stackoverflow.com/questions/5027539/bitronix-spring-hibernate-persistence
I think this might not be possible.
What is the disadvantage of runnig JBPM5 process in non persistent mode?
Or can I configure the persistant mode to run without a XA datasource ie without any third party Transaction manager like Bitronix.
Another question is if my server crash and if the process was at a human task node, will it be still at the same node after a restart and would it
be able to continue from there without a persistence configuration or will I have to start the process from the beginning?
Thanks!
-
3. Re: JBPM5, Spring, BTM and Tomcat
snyperboss Nov 28, 2011 7:49 AM (in response to snyperboss)Hi All,
I could Integrate this using spring in a single bean defenition file.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="basicdataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property> <property name="url"> <value>jdbc:mysql://localhost:3306/test</value> </property> <property name="username"> <value>root</value> </property> <property name="password"> <value>qaz@12345</value> </property> </bean> <bean id="xadataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close"> <property name="className" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" /> <property name="uniqueName" value="jdbc/testDS1" /> <property name="minPoolSize" value="1" /> <property name="maxPoolSize" value="5" /> <property name="allowLocalTransactions" value="true" /> <property name="driverProperties"> <props> <prop key="URL">jdbc:mysql://localhost:3306/test</prop> <prop key="user">root</prop> <prop key="password">qaz@12345</prop> </props> </property> </bean> <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager" ref="bitronixTransactionManager" /> <property name="userTransaction" ref="bitronixTransactionManager" /> </bean> <bean id="bitronixTransactionManager" factory-method="getTransactionManager" class="bitronix.tm.TransactionManagerServices" depends-on="xadataSource,txManager" destroy-method="shutdown" /> <bean id="entityManagerFactoryJbpmPersistanceJpa" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="xadataSource" /> <property name="persistenceUnitName" value="org.jbpm.persistence.jpa" /> <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <!-- <property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" /> --> <property name="databasePlatform" value="org.hibernate.dialect.SybaseDialect" /> <property name="showSql" value="true" /> <property name="generateDdl" value="false" /> </bean> </property> </bean> <bean id="entityManagerFactoryJbpmTask" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="basicdataSource" /> <property name="persistenceUnitName" value="org.jbpm.task" /> <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <!-- <property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" /> --> <property name="databasePlatform" value="org.hibernate.dialect.SybaseDialect" /> <property name="showSql" value="true" /> <property name="generateDdl" value="false" /> </bean> </property> </bean> <bean id="testInsertDAO" class="com.sample.TestInsertDAO"> <property name="dataSource" ref="basicdataSource" /> </bean> </beans>
Thanks!
-
4. Re: JBPM5, Spring, BTM and Tomcat
qintao1203 Nov 29, 2011 12:31 AM (in response to snyperboss)In JBPM5.1 , JPAKnowledgeService must be find jndi of transaction from container.
-
5. Re: JBPM5, Spring, BTM and Tomcat
jbpmdev Dec 5, 2011 10:21 PM (in response to snyperboss)Hi snyperboss ,
This configuration helped me lot.Could you please share the complete code with us?i am new here.
Thanks in advance
-
6. Re: JBPM5, Spring, BTM and Tomcat
snyperboss Dec 7, 2011 5:05 AM (in response to jbpmdev)Hi,
This is how I create the session using the above spring configuration.
public static StatefulKnowledgeSession createSession() throws Exception { /* * Create the knowledgebase using the required bpmn and drl files */ KnowledgeBase kbase = readKnowledgeBase("SampleHumanTaskFormVariables.bpmn"); //EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" ); EntityManagerFactory emf = (EntityManagerFactory) HumanTaskStartupServlet.context.getBean("entityManagerFactoryJbpmPersistanceJpa"); Environment env = KnowledgeBaseFactory.newEnvironment(); env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ); env.set( EnvironmentName.TRANSACTION_MANAGER, HumanTaskStartupServlet.context.getBean("bitronixTransactionManager") ); env.set( EnvironmentName.TRANSACTION, HumanTaskStartupServlet.context.getBean("bitronixTransactionManager") ); env.set( EnvironmentName.GLOBALS, new MapGlobalResolver() ); Properties properties = new Properties(); properties.put("drools.processInstanceManagerFactory", "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory"); properties.put("drools.processSignalManagerFactory", "org.jbpm.persistence.processinstance.JPASignalManagerFactory"); KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties); return JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env); }
Thanks!
-
7. Re: JBPM5, Spring, BTM and Tomcat
jbpmdev Dec 7, 2011 11:58 AM (in response to snyperboss)Thanks for the quik reply.
Actually i confused with the below two steps,
env.set( EnvironmentName.TRANSACTION_MANAGER, HumanTaskStartupServlet.context.getBean("bitronixTransactionManager") );
env.set( EnvironmentName.TRANSACTION, HumanTaskStartupServlet.context.getBean("bitronixTransactionManager") );Now i have corrected and it is working fine now HSQL db
Also for all the transaction, i am using the same "bitronixTransactionManager" object like below,
bitronixTransactionManager.begin();
bitronixTransactionManager.commit()
is that correct ??
Still i found the "StatefulKnowledgeSession" and all BPMN conf also configurable in spring itself instead of doing this way,i have to implement like this later.
http://community.jboss.org/message/599448
Now i am trying to use XA Database to point Oracle.getting some issues
Thanks again for your help!!
Tc.
-
8. Re: JBPM5, Spring, BTM and Tomcat
sasir Mar 7, 2012 3:06 PM (in response to snyperboss)Guys,
Are you also using JPA in your project. Am trying to use Spring 3 + JTA + JPA + Bitronix. I dont have any issues in persisting data into Task/Process tables howevfer whiel inserting into APP DB, no data is getting inserted and no error is shown.
In your case, are inserts into app db also part of transaction? if so, Can you please share that configuration
-
9. Re: JBPM5, Spring, BTM and Tomcat
gigazhang Apr 20, 2012 5:39 AM (in response to snyperboss)Thanks for your tipic!