org.ofbiz.webapp.stats.ServerHitBin.saveHit(...) causes transactions to be aborted due to duplicate PKs.
The problem is that said method will try to create two or more entries with identical startTimes (i.e. duplicate hitStartDateTime and the other fields composing the PK: visitId, contentId, hitStartDateTime, hitTypeId) if two or more subsequent requests are made in a sufficiently small interval. This can and will be the case for example if an application rapidly issues requests for similar data. It would usually not be observed when human users cause requests being issued.
The cause is that the above mentioned method uses
to store the entries.
A solution to this is to create or update an existing entry, thus overwriting an existing entry in case there already was an entry, but more importantly avoiding the actual transaction being aborted. This may not satisfy those who want to record each and every server hit even with equal startTimes. For these cases other approaches might be considered ...
This is an example where a transaction fails due to saveHit(...). In our case an applet tries to pull data off the server and fails ...
This issue seems to be related (it refers to the releae branch 4.0 and the same error shows up):