AnsweredAssumed Answered

Configuring Database with Activiti.cfg.xml

Question asked by monika_b on Nov 26, 2013
Latest reply on Dec 5, 2013 by frederikheremans1
I am new to activiti. I need to configure one existing database with activiti. I am getting below exception. Please help.

Q: If I use H2 Database. I gave maven dependency already and set datasource as below.
<bean id="dataSource"
        class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
        <property name="driverClass" value="org.h2.Driver" />
        <property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
        <property name="username" value="sa" />
        <property name="password" value="" />
    </bean>
I am using eclipse IDE, Spring, Maven SetUp (Declared H2 DB Jar). Do I need to start this database. I am new to this. Please help.
Note, When I am navigating to any of maven dependency jar class files like Property.xml, my eclipse popups 'NPE'. Is it expected? I am getting this exception for existing project also. so i believe this is not causing the below issue.

I am getting below exception on running with datasource (H2 database or my own database)
17:14:07.979 [main] DEBUG o.a.i.d.pooled.PooledDataSource - PooledDataSource forcefully closed/removed all connections.
org.h2.jdbc.JdbcSQLException: Connection is broken: "session closed" [90067-132]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:316)
   at org.h2.message.DbException.get(DbException.java:167)
   at org.h2.message.DbException.get(DbException.java:144)
   at org.h2.engine.SessionRemote.checkClosed(SessionRemote.java:447)
   at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:326)
   at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:219)
   at org.h2.engine.SessionRemote.createSession(SessionRemote.java:213)
   at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
   at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
   at org.h2.Driver.connect(Driver.java:58)
   at java.sql.DriverManager.getConnection(DriverManager.java:582)
   at java.sql.DriverManager.getConnection(DriverManager.java:154)
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:181)
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:176)
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:80)
   at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:371)
   at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:80)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDatabaseType(ProcessEngineConfigurationImpl.java:586)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDataSource(ProcessEngineConfigurationImpl.java:548)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:393)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:371)
   at com.altisource.MainApp.main(MainApp.java:26)
17:14:26.742 [main] DEBUG o.a.e.i.interceptor.LogInterceptor -                                                                                                    
17:14:26.742 [main] DEBUG o.a.e.i.interceptor.LogInterceptor - — starting SchemaOperationsProcessEngineBuild ——————————————————–
17:14:26.770 [main] DEBUG o.a.i.t.jdbc.JdbcTransaction - Openning JDBC Connection
17:14:45.096 [main] ERROR o.a.e.i.interceptor.CommandContext - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: org.h2.jdbc.JdbcSQLException: Connection is broken: "session closed" [90067-132]
### The error may exist in org/activiti/db/mapping/entity/Property.xml
### The error may involve org.activiti.engine.impl.persistence.entity.PropertyEntity.selectDbSchemaVersion
### The error occurred while executing a query
### Cause: org.h2.jdbc.JdbcSQLException: Connection is broken: "session closed" [90067-132]
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:95) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:59) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:54) ~[mybatis-3.1.1.jar:3.1.1]
   at org.activiti.engine.impl.db.DbSqlSession.getDbVersion(DbSqlSession.java:741) ~[activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion(DbSqlSession.java:697) ~[activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:1111) ~[activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25) ~[activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24) ~[activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:61) ~[activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37) [activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:76) [activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:372) [activiti-engine-5.12.jar:5.12]
   at com.altisource.MainApp.main(MainApp.java:26) [classes/:na]
Caused by: org.h2.jdbc.JdbcSQLException: Connection is broken: "session closed" [90067-132]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:316) ~[h2-1.2.132.jar:1.2.132]
   at org.h2.message.DbException.get(DbException.java:167) ~[h2-1.2.132.jar:1.2.132]
   at org.h2.message.DbException.get(DbException.java:144) ~[h2-1.2.132.jar:1.2.132]
   at org.h2.engine.SessionRemote.checkClosed(SessionRemote.java:447) ~[h2-1.2.132.jar:1.2.132]
   at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:326) ~[h2-1.2.132.jar:1.2.132]
   at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:219) ~[h2-1.2.132.jar:1.2.132]
   at org.h2.engine.SessionRemote.createSession(SessionRemote.java:213) ~[h2-1.2.132.jar:1.2.132]
   at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110) ~[h2-1.2.132.jar:1.2.132]
   at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94) ~[h2-1.2.132.jar:1.2.132]
   at org.h2.Driver.connect(Driver.java:58) ~[h2-1.2.132.jar:1.2.132]
   at java.sql.DriverManager.getConnection(DriverManager.java:582) ~[na:1.6.0_27]
   at java.sql.DriverManager.getConnection(DriverManager.java:154) ~[na:1.6.0_27]
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:181) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:176) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:80) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:371) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:80) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:131) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:58) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:69) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:56) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:141) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:101) ~[mybatis-3.1.1.jar:3.1.1]
   … 13 common frames omitted
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: org.h2.jdbc.JdbcSQLException: Connection is broken: "session closed" [90067-132]
### The error may exist in org/activiti/db/mapping/entity/Property.xml
### The error may involve org.activiti.engine.impl.persistence.entity.PropertyEntity.selectDbSchemaVersion
### The error occurred while executing a query
### Cause: org.h2.jdbc.JdbcSQLException: Connection is broken: "session closed" [90067-132]
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:95)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:59)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:54)
   at org.activiti.engine.impl.db.DbSqlSession.getDbVersion(DbSqlSession.java:741)
   at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion(DbSqlSession.java:697)
   at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:1111)
   at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:61)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37)
   at org.activiti.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:76)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:372)
   at com.altisource.MainApp.main(MainApp.java:26)
Caused by: org.h2.jdbc.JdbcSQLException: Connection is broken: "session closed" [90067-132]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:316)
   at org.h2.message.DbException.get(DbException.java:167)
   at org.h2.message.DbException.get(DbException.java:144)
   at org.h2.engine.SessionRemote.checkClosed(SessionRemote.java:447)
   at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:326)
   at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:219)
   at org.h2.engine.SessionRemote.createSession(SessionRemote.java:213)
   at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
   at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
   at org.h2.Driver.connect(Driver.java:58)
   at java.sql.DriverManager.getConnection(DriverManager.java:582)
   at java.sql.DriverManager.getConnection(DriverManager.java:154)
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:181)
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:176)
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:80)
   at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:371)
   at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:80)
   at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:131)
   at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:58)
   at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279)
   at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:69)
   at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:56)
   at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)
   at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:141)
   at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)
   at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:101)17:14:45.097 [main] DEBUG o.a.e.i.c.s.StandaloneMybatisTransactionContext - firing event rolling back…
17:14:45.098 [main] DEBUG o.a.e.i.c.s.StandaloneMybatisTransactionContext - rolling back ibatis sql session…
17:14:45.098 [main] DEBUG o.a.e.i.c.s.StandaloneMybatisTransactionContext - firing event rolled back…
17:14:45.098 [main] DEBUG o.a.e.i.interceptor.LogInterceptor - — SchemaOperationsProcessEngineBuild finished ——————————————————–
17:14:45.098 [main] DEBUG o.a.e.i.interceptor.LogInterceptor -                                                                                                    

   … 13 more

Outcomes