0 Replies Latest reply on Mar 18, 2016 8:53 AM by sridhar thiyagarajan

    How to avoid java.sql.SQLException - JZ0C0: Connection is already closed. in Wildfly-8.2.0.Final

    sridhar thiyagarajan Novice

      I have deployed an EAR in Wildfly-8.2.0.Final application server. After some hours of inactivity, I am getting the below error in the application server error logs:

       

      Caused by: java.sql.SQLException - JZ0C0: Connection is already closed.

         at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(Unknown Source)

         at com.sybase.jdbc4.jdbc.SybConnection.checkConnection(Unknown Source)

         at com.sybase.jdbc4.jdbc.SybConnection.setAutoCommit(Unknown Source)

         at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.checkTransaction(BaseWrapperManagedConnection.java:893)

         at org.jboss.jca.adapters.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:1594)

         at org.jboss.jca.adapters.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:398)

         at com.test.it.TestConnection.prepareStatement(TestConnection.java:1045)

       

      Please find below the datasource subsystem definition used in standalone-full-ha.xml.

       

      <subsystem xmlns="urn:jboss:domain:datasources:2.0">
        
      <datasources>
        
      <datasource jta="true" jndi-name="java:/SybaseDB" pool-name="SybaseDB" enabled="true" use-java-context="true" spy="false" use-ccm="true">
        
      <connection-url>jdbc:sybase:Tds:id_address:port/DBname</connection-url>
        
      <driver-class>com.sybase.jdbc4.jdbc.SybDriver</driver-class>
        
      <connection-property name="HOSTNAME">TestHost</connection-property>
        
      <connection-property name="SQLINITSTRING">set quoted_identifier,forceplan off</connection-property>
        
      <connection-property name="LANGUAGE">us_english</connection-property>
        
      <connection-property name="CHARSET">iso_1</connection-property>
        
      <connection-property name="APPLICATIONNAME">TestApp</connection-property>
        
      <connection-property name="IS_CLOSED_TEST">select 1</connection-property>
        
      <connection-property name="PACKETSIZE">1024</connection-property>
        
      <driver>SybaseDB</driver>
        
      <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
        
      <pool>
        
      <min-pool-size>5</min-pool-size>
        
      <initial-pool-size>5</initial-pool-size>
        
      <max-pool-size>200</max-pool-size>
        
      <prefill>false</prefill>
        
      <use-strict-min>false</use-strict-min>
        
      <flush-strategy>FailingConnectionOnly</flush-strategy>
        
      </pool>
        
      <security>
        
      <security-domain>EncryptDBPassword</security-domain>
        
      </security>
        
      <validation>
        
      <check-valid-connection-sql>select 1</check-valid-connection-sql>
        
      <use-fast-fail>true</use-fast-fail>
        
      </validation>
        
      <timeout>
        
      <blocking-timeout-millis>15000</blocking-timeout-millis>
        
      <idle-timeout-minutes>30</idle-timeout-minutes>
        
      </timeout>
        
      <statement>
        
      <track-statements>false</track-statements>
        
      </statement>
        
      </datasource>
        
      <drivers>
        
      <driver name="SybaseDB" module="jdbc.jconn4"/>
        
      </drivers>
        
      </datasources>
        
      </subsystem
      >


      Could anyone please help me whether I am missing an attribute in datasource definition which gives me this error.