Tracing Activiti execution within an Eclipse JUnit test

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2011 06:09 PM
Hi,
I'm trying to turn on Activiti engine debug logging when running the engine from a JUnit test in Eclipse. I've tried placing the following line
org.activiti.level=FINEST
in assorted property locations, but have so far been unable to get any logging.
In particular, i'm trying to find the cause for the following stack trace:
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1218' for key 'PRIMARY'
### The error may involve org.activiti.persistence.insertVariableInstance-Inline
### The error occurred while setting parameters
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1218' for key 'PRIMARY'
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:100)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:87)
at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:392)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:319)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:135)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:91)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:49)
…
It comes and goes in a single test case, and appears more likely to occur when I run all the tests in a suite at once.
Thanks,
bwd.
I'm trying to turn on Activiti engine debug logging when running the engine from a JUnit test in Eclipse. I've tried placing the following line
org.activiti.level=FINEST
in assorted property locations, but have so far been unable to get any logging.
In particular, i'm trying to find the cause for the following stack trace:
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1218' for key 'PRIMARY'
### The error may involve org.activiti.persistence.insertVariableInstance-Inline
### The error occurred while setting parameters
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1218' for key 'PRIMARY'
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:100)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:87)
at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:392)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:319)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:135)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:91)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:49)
…
It comes and goes in a single test case, and appears more likely to occur when I run all the tests in a suite at once.
Thanks,
bwd.
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2011 09:32 PM
I have suspicions that this may be related to threading.
Can someone describe the thread usage by the engine? I see the following in the user guide "The JobExecutor is a component that manages a couple of threads to fire timers (and later also asynchronous messages).", but little mention elsewhere.
Here's why I'm thinking in this direction:
- We're using a DataSource object that switches pools based on a thread-local 'instance-id'. The value for this is set on the thread when a request comes in and cleared immediately before the thread returns from the request. The same data source is being used by Activiti based on Spring configuration (and I see data spread across database schemas in the Activiti tables). If a database write went to the wrong schema, i'm guessing it could produce the error described above.
I do see some discussion of multi-tenancy on a different post (http://forums.activiti.org/en/viewtopic.php?f=6&t=1208&p=4926&hilit=tenant#p4926). Have there been any updates wrt the best way to approach multi-tenancy?
Thanks,
bwd
Can someone describe the thread usage by the engine? I see the following in the user guide "The JobExecutor is a component that manages a couple of threads to fire timers (and later also asynchronous messages).", but little mention elsewhere.
Here's why I'm thinking in this direction:
- We're using a DataSource object that switches pools based on a thread-local 'instance-id'. The value for this is set on the thread when a request comes in and cleared immediately before the thread returns from the request. The same data source is being used by Activiti based on Spring configuration (and I see data spread across database schemas in the Activiti tables). If a database write went to the wrong schema, i'm guessing it could produce the error described above.
I do see some discussion of multi-tenancy on a different post (http://forums.activiti.org/en/viewtopic.php?f=6&t=1208&p=4926&hilit=tenant#p4926). Have there been any updates wrt the best way to approach multi-tenancy?
Thanks,
bwd
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2011 02:40 AM
Using different DB schema's on the same datasource can explain why this error occurs. Probabily the ID is retrieved from one datasource, and new variable is written to to other datasource using the wrong id.
Nothing new on multi-tenant support in activiti…
Nothing new on multi-tenant support in activiti…
