Nov 1, 2018

How to fix Glassfish: PoolingException: javax.resource.spi.LocalTransactionException: Communications link failure

Try to restart your Glassfish.

If the problem is still there, check your connection validation type. If it is set to "autocommit" (the default), the JDBC drivers may cache the prior connection validation data, and no actual database interaction will happen during future connection validations.

To resolve the problem, set connection-validation-method="table" and validation-table-name="any_table_you_know_exists". Doing this forces the connections to talk to the database instead of the cache; if the connection is invalid, it will be dropped and recreated. You may need to also specify is-connection-validation-required="true".

AS_INSTALL_ROOT/bin/asadmin set = true

AS_INSTALL_ROOT/bin/asadmin set domain.resources.jdbc-connection-pool.DerbyPool.connection-validation-method=table
domain.resources.jdbc-connection-pool.DerbyPool.connection-validation-method = table

bin/asadmin set domain.resources.jdbc-connection-pool.DerbyPool.validation-table-name=sys.systables
domain.resources.jdbc-connection-pool.DerbyPool.validation-table-name = sys.systables

See also:

  1. This article also explains the problem in detail.
  2. Jagadish's Oracle Blog Article on this topic has more info.
  3. Article explaining Glassfish JDBC Connection Validation in detail.