Openbravo Issue Tracking System - Modules
View Issue Details
0029089Moduleszz obsolete Activiti Integrationpublic2015-02-27 09:292015-02-27 11:06
alostale 
alostale 
normalminorN/A
newopen 
5
 
 
0029089: Activiti integration uses its own db pool, it should use Openbravo's one
Activiti integration module uses its own database connection pool. This can lead to problems managing connections.

Current implementation is org.apache.commons.dbcp.BasicDataSource [1]

[1] http://commons.apache.org/proper/commons-dbcp/api-1.4/org/apache/commons/dbcp/BasicDataSource.html [^]
One of the problems of this additional pool is reported in issue 0028915
Ideally, it should reuse the same pool defined for Openbravo (default one or any external one).

DataSource for activiti module is defined in applicationContext.xml file:

...
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${hibernate.connection.driver_class}" />
    <property name="url" value="${hibernate.connection.url}" />
    <property name="username" value="${hibernate.connection.username}" />
    <property name="password" value="${hibernate.connection.password}" />
     <property name="defaultAutoCommit" value="false" />
  </bean>
...

According to activiti documentation ([1] and [2]), it should be possible to implement a javax.sql.DataSource
making use of Openbravo pool.

First attempt implemented by the attached file results in errors on Tomcat start up:

### Error updating database. Cause: java.sql.SQLException: Connection is closed.
### The error may exist in org/activiti/db/mapping/entity/VariableInstance.xml
### The error may involve org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.insertByteArray_postgres
### The error occurred while executing an update
### SQL: insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_) values ( ?, 1, ?, ?, ? )
### Cause: java.sql.SQLException: Connection is closed.
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:120)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:107)
    at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:420)
    at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:347)
    at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:147)
    at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:103)
    at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
    at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)


---
[1] http://www.activiti.org/userguide/#databaseConfiguration [^]
[2] http://www.activiti.org/userguide/#_changing_the_database_and_connection_pool [^]
No tags attached.
related to defect 0028915 closed alostale Not possible to start tomcat after use the dunning module 
? ActivitiDataSource.java (2,133) 2015-02-27 11:06
https://issues.openbravo.com/file_download.php?file_id=7840&type=bug
Issue History
2015-02-27 09:29alostaleNew Issue
2015-02-27 09:29alostaleAssigned To => mtaal
2015-02-27 09:29alostaleAssigned Tomtaal => alostale
2015-02-27 09:29alostaleRelationship addeddepends on 0028915
2015-02-27 09:30alostaleRelationship replacedrelated to 0028915
2015-02-27 09:30alostaleProposed Solution updated
2015-02-27 09:33alostaleDescription Updatedbug_revision_view_page.php?rev_id=7804#r7804
2015-02-27 10:05hgbotCheckin
2015-02-27 10:05hgbotNote Added: 0075018
2015-02-27 11:06alostaleFile Added: ActivitiDataSource.java
2022-02-18 04:21priyamCategoryActiviti Integration => Z_Obsolete Activiti Integration
2022-02-18 04:24priyamCategoryZ_Obsolete Activiti Integration => zz obsolete Activiti Integration

Notes
(0075018)
hgbot   
2015-02-27 10:05   
Repository: erp/mods/org.openbravo.activiti
Changeset: 9ce8cc16cb256dbc480cd116b949a6c454c07ae3
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Feb 27 09:45:58 2015 +0100
URL: http://code.openbravo.com/erp/mods/org.openbravo.activiti/rev/9ce8cc16cb256dbc480cd116b949a6c454c07ae3 [^]

fixed bug 28915: tomcat does not start when number of jobs to execute is big

  The problem is due the extra pool activiti uses, which was configured to acquire
  at most 8 connections and to wait for one of them is released when an extra one
  is required.

  When in this situation, more than 8 connections are used in parallel causing a
  deadlock situation.

  Temporary solution, till issue 29089 is fixed, consists in allowing activiti module
  to grow as much as needed, restoring to a maximum of 5 idle connections once the
  rest are released.

---
M config/applicationContext.xml
---