How to fix "Could not open JDBC Connection for transaction; nested exception is java.sql.SQLTransientConnectionException: ReportingPool - Connection is not available" error in XL Release?

Follow

Shashank Srivastava -

Issue

You upgrade to XL Release version 8.x.x & then you run a Groovy script task. Your task fails & an error message similar to below is seen.

Exception during execution:
org.springframework.transaction.CannotCreateTransactionException: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLTransientConnectionException: ReportingPool - Connection is not available, request timed out after 30000ms. in <script> at line number 23
Environment 

XL Release, Groovy script

Resolution

To fix this error, you will need to modify your conf/script.policy file & add below section to it.

// API - access to database
permission java.sql.SQLPermission "setLog";
permission java.sql.SQLPermission "callAbort";
permission java.sql.SQLPermission "setSyncFactory";
permission java.sql.SQLPermission "setNetworkTimeout";

After adding this, restart XL Release & run the task again. Your task will run without any issues now.

Cause

This error occurs when you upgrade from XL Release 7.x.x to 8.x.x. XL Release 8.x.x ships with an additional API access section (which you just added above).

Previous versions of XL Release didn't have this configuration & hence, the execution of the task fails with the said error.

Additional Information

Below is the sample stack-trace that is seen when this issue occurs.

2018-10-23 21:36:15.649 [scheduler-pool-1-thread-35] {task=Applications/Folder202184669/Release37c2571f290b4ac0ab12346d146491f7/Phase3999744/Task312474411} WARN c.x.x.s.jython.JythonScriptService - Exception during execution
javax.script.ScriptException: org.springframework.transaction.CannotCreateTransactionException: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLTransientConnectionException: ReportingPool - Connection is not available, request timed out after 30008ms. in <script> at line number 30

Caused by: java.security.AccessControlException: access denied ("java.sql.SQLPermission" "setNetworkTimeout")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)

Tags

xlrelease, troubleshooting, how-to, script.policy, groovy, task

Have more questions? Submit a request