MySQL: Error storing offline presence of user: _sheepy_

Hi,

My openfire server is attached to a MySQL DB and I see in the logs the following problem:

011.06.30 23:05:11 Error storing offline presence of user: someuser

com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry ‘someuser’ for key 1

Does anyone know why this happens? Should maybe in the code the insert into with a insert ignore into replaced?

Cheers,

Michael

Hi Michael,

that’s a really old bug in Openfire. There was a patch provided some time ago, but that was only woking for MySQL and not for other DB’s. Consequently it was rejected. I can not find it right now, but I am pretty sure that it was a more or less trivial fix in the SQL.

Walter

Thanks for your answer.

How important is this for openfire that the offline presence gets stored without an error?

We’re basicly using MUC in our installation and disabled a lot of things like e.g. the offline message storage…

I changed the following in the PresenceManagerImpl.java

Line 80: private static final String INSERT_OFFLINE_PRESENCE = “INSERT INTO ofPresence(username, offlinePresence, offlineDate) VALUES(?,?,?)”;

Change To: private static final String INSERT_OFFLINE_PRESENCE = “REPLACE INTO ofPresence(username, offlinePresence, offlineDate) VALUES(?,?,?)”;

Fixed it for me.