1 Reply Latest reply on May 15, 2015 2:11 AM by Lyle Wang

    JBoss EAP 6.4 closed connection after server idle for a while

    Giang Pham Newbie

      Hello,

       

      I have a Spring web application running on Jboss EAP 6.4

      I'm using JPA to connect to JBOSS data source through JNDI name.

       

      Here's JPA xml configuration:

      <beans:bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

        <beans:property name="dataSource" ref="dataSource" />

        <beans:property name="persistenceUnitName" value="myPersistence" />

        <beans:property name="jpaVendorAdapter">

        <beans:bean

        class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">

        <beans:property name="generateDdl" value="false" />

        <beans:property name="showSql" value="true" />

        </beans:bean>

        </beans:property>

        <beans:property name="packagesToScan" value="com.my" />

      </beans:bean>

       

      <beans:bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">

        <beans:property name="entityManagerFactory" ref="entityManagerFactory" />

      </beans:bean>

       

       

        <!-- ORACLE DATABASE SETUP -->

      <beans:bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">

        <beans:property name="jndiName" value="java:/DATA"/>

      </beans:bean>


      Here's Datasource configuration on JBOSS


       

      Min Pool Size:

       

      5

       

      Max Pool Size:

       

      30

       

      Strict Minimum:

       

      false

       

      Prefill enabled:

       

      false

       

      Flush Strategy:

       

      FailingConnectionOnly

       

      Idle Timeout:

       

      15

       

      Track Statements:

       

       

       

      The error's stack traces after calling a rest service to get information from DB after leaving application idle for 60 mins:

       

      10:08:30,332 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/127.0.0.1:8080-1) SQL Error: 17002, SQLState: 08006

      10:08:31,800 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/127.0.0.1:8080-1) Io exception: Connection reset

      10:08:33,682 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/portal-fe].[spring]] (http-/127.0.0.1:8080-1) JBWEB000236: Servlet.service() for servlet spring threw exception: java.sql.SQLException: Closed Connection

        at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) [ojdbc6-11.2.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]

        at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133) [ojdbc6-11.2.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199) [ojdbc6-11.2.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263) [ojdbc6-11.2.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271) [ojdbc6-11.2.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445) [ojdbc6-11.2.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]

        at oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:3450) [ojdbc6-11.2.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]

        at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.jdbcRollback(BaseWrapperManagedConnection.java:1117)

        at org.jboss.jca.adapters.jdbc.WrappedConnection.rollback(WrappedConnection.java:779)

        at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doRollback(JdbcTransaction.java:163) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]

        at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.rollback(AbstractTransactionImpl.java:209) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]

        at org.hibernate.ejb.TransactionImpl.rollback(TransactionImpl.java:106) [hibernate-entitymanager-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]

        at org.springframework.orm.jpa.JpaTransactionManager.doRollback(JpaTransactionManager.java:542) [spring-orm-4.0.0.RELEASE.jar:4.0.0.RELEASE]

      ...

       

      Please help to advise as I'm new to this.

       

      Thanks