cancel
Showing results for 
Search instead for 
Did you mean: 

Websphere transaction management

mvharish
Champ on-the-rise
Champ on-the-rise
Hi, My project environment is jdk1.6,Websphere8.5 with activiti 5.14 .We use two XA datasources with CMP ,the first XA datasource is used to store the user related data and second one is being used by Activiti engine. and the rollback should happen in the case of exceptions at any of the scenario ie either while storing user data some exception or while doing some transition in activiti.

I was trying to do activiti cfg setup .It will be helpfull if i get some pointers to start with.

Will the below configuration will solve the problem ? where the datasource is a XA one.

   <bean id="transactionManager"
      class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>

   <!– process engine configuration –>
   <bean id="processEngineConfiguration"
      class="org.activiti.spring.SpringProcessEngineConfiguration">
      <property name="dataSourceJndiName" value="jdbc/activitiDSH2" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="transactionsExternallyManaged" value="true" />
      <property name="databaseSchemaUpdate" value="false" />

      <property name="mailServerHost" value="localhost" />
       <property name="mailServerPort" value="2525" /> 

   </bean>
9 REPLIES 9

trademak
Star Contributor
Star Contributor
Hi,

That configuration looks fine to me. Is it working for you?

Best regards,

mvharish
Champ on-the-rise
Champ on-the-rise
Hi,
I am using this piece of code to initialize my above datasource which is a XA one :

ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault().buildProcessEngine();
with the setting :

<property name="databaseSchemaUpdate" value="true" />

But it seems there is some issue while creating the process engine as I am getting below error:

[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R java.sql.SQLException: [jcc][t4][10205][11234][3.57.82] Null userid is not supported. ERRORCODE=-4461, SQLSTATE=42815 DSRA0010E: SQL State = 42815, Error Code = -4,461
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.am.bd.a(bd.java:676)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.am.bd.a(bd.java:60)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.am.bd.a(bd.java:103)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.t4.b.D(b.java:1928)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.t4.b.g(b.java:1935)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.t4.b.c(b.java:700)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.t4.b.b(b.java:687)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.t4.b.a(b.java:374)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.t4.b.<init>(b.java:310)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.t4.c.<init>(c.java:32)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.DB2PooledConnection.<init>(DB2PooledConnection.java:193)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.DB2XAConnection.<init>(DB2XAConnection.java:56)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:168)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:136)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreHelper$1.run(InternalGenericDataStoreHelper.java:1353)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreHelper.getPooledConnection(InternalGenericDataStoreHelper.java:1372)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.rsadapter.spi.InternalDB2UniversalDataStoreHelper.getPooledConnection(InternalDB2UniversalDataStoreHelper.java:1821)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:2029)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.getConnection(WSManagedConnectionFactoryImpl.java:1778)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:1548)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:1104)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ejs.j2c.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:2160)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ejs.j2c.FreePool.createOrWaitForConnection(FreePool.java:1838)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:3808)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:3084)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:1548)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:1031)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:644)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:611)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDatabaseType(ProcessEngineConfigurationImpl.java:586)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDataSource(ProcessEngineConfigurationImpl.java:548)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:384)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:362)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at org.activiti.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:61)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.candidjava.MyController.execute(MyController.java:66)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1071)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:909)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[1/1/14 22:02:12:701 IST] 00000076 SystemErr     R  at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[1/1/14 22:02:12:717 IST] 00000076 SystemErr     R  at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[1/1/14 22:02:12:717 IST] 00000076 SystemErr     R  at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[1/1/14 22:02:12:717 IST] 00000076 SystemErr     R  at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
[1/1/14 22:02:12:717 IST] 00000076 SystemErr     R  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
[1/1/14 22:02:13:559 IST] 00000076 LocalTranCurr E   WLTC0027E: No LocalTransactionCoordinator to cleanup.
[1/1/14 22:02:13:559 IST] 00000076 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception root cause action: javax.servlet.ServletException: org.springframework.transaction.TransactionSystemException: UOWManager transaction processing failed; nested exception is com.ibm.wsspi.uow.UOWException: java.lang.IllegalStateException: No LocalTransactionCoordinator to end.
at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)

jbarrez
Star Contributor
Star Contributor
Could it be DDL statements are prohibited by this datasource config?
Another option is to use the .sql files from the zip download on the website to create the database schema.

mvharish
Champ on-the-rise
Champ on-the-rise
Hello Again,

What I did is that I ran the sql files seperately on my DB2 based XA datasource which is configured in IBM WAS8.5 and configured activiti cfg xml as below

<?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="transactionManager"
  class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>

<!– process engine configuration –>
<bean id="processEngineConfiguration"
  class="org.activiti.spring.SpringProcessEngineConfiguration">
  <property name="dataSourceJndiName" value="XXXWflowDS" />
  <property name="databaseTablePrefix" value="ACTIVITI." />
  <property name="databaseSchema" value="ACTIVITI" />
  <property name="transactionManager" ref="transactionManager" />
  <property name="transactionsExternallyManaged" value="true" />
  <property name="databaseSchemaUpdate" value="false" />
   <property name="mailServerHost" value="localhost" />
  <property name="mailServerPort" value="2525" />
</bean>

<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
    <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  </bean>
 
  <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
</beans>

ClassPathXmlApplicationContext applicationContext =
       new ClassPathXmlApplicationContext("SpringTransactionIntegrationTest-context.xml");
ProcessEngineConfiguration processEngineConfig = (ProcessEngineConfiguration)applicationContext.getBean("processEngineConfiguration");
ProcessEngine processEngine = processEngineConfig.buildProcessEngine();


Now I am getting EmptyStack Trace execption for ProcessEngine.
Am I missing anything over here?

mvharish
Champ on-the-rise
Champ on-the-rise
Hello Again,
Now I am able to make a connection with db2 but its connecting to default schema.Is there a way of connecting to different schema in DB2 I have tried using databasetablePrefix under SpringProcessEngineConfiguration and it seems it is not recognising the value provided over there.

frederikherema1
Star Contributor
Star Contributor
Can't you set the target schema in the datasource URL directly?

mvharish
Champ on-the-rise
Champ on-the-rise
Hi, I am <jee:jndi-lookup feature of spring to pass the datasource as in our project respective to modules we have different schema.So I am not sure how to configure schema name in the datasource inside jndi-lookup.

mvharish
Champ on-the-rise
Champ on-the-rise
sorry for the delayed response.But I was able to configure transaction successfully into our project and feeling very proud to say that YEAH!! Activiti is up and running with full force!!! Smiley Happy

trademak
Star Contributor
Star Contributor
Great, thanks for posting this.

Best regards,