Support Article

DuplicateKeyException Running multiple File Listeners



Two 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 Messages

Error in commit() 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 Reproduce

Execute two or more File Listeners at the same time using JBoss and SQLServer 2012.

Root Cause

The 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.


Make 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

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.