Process engine persistence exception - Embedded process engine


#1

Hi, we experienced this exception:

java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:115)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at java.io.DataOutputStream.write(DataOutputStream.java:107)
at net.sourceforge.jtds.jdbc.SharedSocket.sendNetPacket(SharedSocket.java:686)
at net.sourceforge.jtds.jdbc.RequestStream.putPacket(RequestStream.java:570)
at net.sourceforge.jtds.jdbc.RequestStream.flush(RequestStream.java:518)
at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1080)
… 98 common frames omitted
Wrapped by: java.sql.SQLException: I/O Error: Connection reset
at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1093)
at net.sourceforge.jtds.jdbc.TdsCore.submitSQL(TdsCore.java:938)
at net.sourceforge.jtds.jdbc.JtdsConnection.setAutoCommit(JtdsConnection.java:2312)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.datasource.pooled.PooledConnection.invoke(PooledConnection.java:245)
at com.sun.proxy.$Proxy22.setAutoCommit(Unknown Source)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:102)
… 90 common frames omitted
Wrapped by: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: java.sql.SQLException: I/O Error: Connection reset
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:107)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:142)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:60)
at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336)
at org.apache.ibatis.executor.BatchExecutor.doQuery(BatchExecutor.java:90)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
… 81 common frames omitted
Wrapped by: org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: java.sql.SQLException: I/O Error: Connection reset

The error may exist in org/camunda/bpm/engine/impl/mapping/entity/EventSubscription.xml

The error may involve org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity.selectEventSubscriptionByQueryCriteria

The error occurred while executing a query

Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: java.sql.SQLException: I/O Error: Connection reset

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)

Having read the other threads related to this issue its due to the server closing the connection. The suggestions in those other threads it to configure testOnBorrow and validationQuery. What is the corresponding configuration for the embedded java engine. This is out setup currently:

private val workflowConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()
.setJdbcDriver(“net.sourceforge.jtds.jdbc.Driver”)
.setJdbcUrl(url)
.setJdbcUsername(username)
.setJdbcPassword(password)
.setJdbcMaxActiveConnections(20)
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
.setHistory(ProcessEngineConfiguration.HISTORY_FULL)
.setJobExecutorActivate(true)


#2

A “java.net.SocketException: Socket closed” exception can happen in various situations. Either the server side closed the connection like nKn suggested, or the client side (your app) closed the connection. Even if you are not aware of doing it, there may be some less obvious code that may lead to closing the socket, like Thread.interrupt() or ExecutorService.shutdownNow().

Check this … simple socket programming in java


#3

@Andrew_Henderson do you running the camunda as spring boot application with spring security?


#4

I resolved this by using setJdbcPingEnabled, setJdbcPingQuery and setJdbcPingConnectionNotUsedFor when setting up the process engine.