DuplicateKeyException Running multiple File Listeners
SummaryTwo File Listeners are running and each of these have their own unique file path.
These File listeners are creating work item depending on several business conditions by invoking pxCreateTopCase, an Out-of-the-box (OOTB) activity.
When both listeners are creating work at the same time, sometimes duplicate work object IDs are being created and this is resulting in errors.
JBoss and SQLServer 2012 are in use.
Error MessagesError in commit()
com.pega.pegarules.pub.database.DuplicateKeyException: Violation of PRIMARY KEY constraint < Primary KEY Name>. Cannot insert duplicate key in object <Work Table Name> The duplicate key value is <PZINSKEY>
Steps to ReproduceExecute two or more File Listeners at the same time using JBoss and SQLServer 2012.
Root CauseThe Pega code calls DatabaseImpl.setAutoCommitOffAndStartTransaction(aConn); which is meant to set autocommit to false, however this was not working as expected. An additional JBoss datasource setting is required for this to work properly.
ResolutionMake the following change to the operating environment:
Add jta=”true” to the Pega datasources in JBoss. For example:
<datasource jta="true" jndi-name="java:/jdbc/AdminPegaRULES" pool-name="AdminPegaRULES" enabled="true" use-ccm="false">
Published February 23, 2017 - Updated March 1, 2017