Rule-Admin-Product Export Exception
When attempting to export an application either through a product rule, or through the product export wizard Pega produces an exception with no other message.
Caused by: org.postgresql.util.PSQLException: This connection has been closed.
at sun.reflect.GeneratedMethodAccessor64.invoke(Unknown Source)
at com.sun.proxy.$Proxy4.getAutoCommit(Unknown Source)
... 17 more
Steps to Reproduce
- Create a new Product Rule with application rules listed
- Export package from Product Rule
A defect or configuration issue in the operating environment. A third-party product issue: the exception is occurring because connection is getting close from the Postgres side, due to timeouts. After adjusting connection pool settings found the export runs without error but the RAP file is empty. From alert log see that as part of export activity pxLoadInventories is being called. This activity is querying a work history table with over a million records. This query is timing out.
Perform the following local-change:
Add the following connection pool settings to the jdbc/PegaRULES datasource
This will cause the validation query to be executed at the specific points in time as follows:
testOnBorrow - If true connections will be validated before being returned from the pool. If the validation fails, the connection is destroyed, and a new connection will be retrieved from the pool (and validated).
testOnConnect - The indication of whether objects will be validated when a connection is first created. If an object fails to validate, it will be throw SQLException.
testOnReturn - If true connections will be validated before being returned to the pool. If the validation fails, the connection is destroyed instead of being returned to the pool.
testWhileIdle - If true connections will be validated by the idle connection evictor (if any). If the validation fails, the connection is destroyed and removed from the pool
The validation query above is valid for Postgres. Consult the specific database vendor for appropriate validation query to use.
To work around the long running query that is causing the export of the RAP to fail you can truncate the work history table, as this is a dev environment and you are not concerned about these history records.