I am building a system on top of jbpm, which is deployed on JBOSS AS 7.1 server. I am using JPA as persistence layer, with hibernate as provider. I am seeing a "Connection closed" issue with error code "SQL Error: 17002, SQLState: 08006", once i leave the system idle for more than 30 minutes.
I am using Oracle database, where idle timeout is set as 20 minutes.
Here is my persistence xml:
Code:
<persistence
version="2.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd
http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="asapmstr" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>java:jboss/akASAPMSTRDatabase</non-jta-data-source>
<class>com.mycomp.wfmanager.dataaccess.model.Accounts</class>
<class>com.mycomp.wfmanager.dataaccess.model.PortalUsers</class>
<properties>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.id.new_generator_mappings" value="false" />
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="hibernate.connection.pool_size" value="0"/>
</properties>
</persistence-unit>
</persistence>
In JBOSS standalone-full.xml, data source is defined like:
Code:
<datasource jta="false" jndi-name="java:jboss/akASAPMSTRDatabase" pool-name="java:jboss/akASAPMSTRDatabase" use-ccm="false">
<connection-url>jdbc:oracle:thin:@myserverip:1521/QASRV</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>oracle-driver</driver>
<security>
<user-name>asapmstr</user-name>
<password>mypassword</password>
</security>
<validation>
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
<background-validation>true</background-validation>
<background-validation-millis>6000</background-validation-millis>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
Can someone please point out, if i am doing something wrong which can lead to "Connection closed" issue. I have included the validation tags in standalone-full.xml to perform liveliness check. Any help would be greatly appreciated.