<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Error on Startup: key PRIMARY in userEvents]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">after (updateing ubuntu) rebooting after a long time I get this error message at startup:</p>
<blockquote></blockquote>
<p dir="auto">01.05.2010 22:49:23 org.apache.catalina.core.ApplicationContext log<br />
INFO: Initializing Spring root WebApplicationContext<br />
01.05.2010 22:49:30 org.apache.catalina.core.StandardContext listenerStart<br />
SCHWERWIEGEND: Exception sending context initialized event to listener instance of class com.serotonin.mango.MangoContextListener<br />
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [insert into userEvents (eventId, userId, silenced) values (?,?,?)]; Duplicate entry '725-3' for key 'PRIMARY'; nested exception is java.sql.BatchUpd<br />
ateException: Duplicate entry '725-3' for key 'PRIMARY'<br />
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:292)<br />
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:606)<br />
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:618)<br />
at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:865)<br />
at com.serotonin.mango.db.dao.EventDao.insertUserEvents(EventDao.java:121)<br />
at com.serotonin.mango.rt.EventManager.raiseEvent(EventManager.java:115)<br />
at com.serotonin.mango.rt.event.type.SystemEventType.raiseEvent(SystemEventType.java:95)<br />
at com.serotonin.mango.rt.EventManager.resetHighestAlarmLevel(EventManager.java:216)<br />
at com.serotonin.mango.rt.EventManager.initialize(EventManager.java:244)<br />
at com.serotonin.mango.MangoContextListener.eventManagerInitialize(MangoContextListener.java:339)<br />
at com.serotonin.mango.MangoContextListener.contextInitialized(MangoContextListener.java:92)<br />
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)<br />
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)<br />
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)<br />
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)<br />
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)<br />
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)<br />
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)<br />
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)<br />
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)<br />
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)<br />
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)<br />
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)<br />
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)<br />
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)<br />
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)<br />
at org.apache.catalina.core.StandardService.start(StandardService.java:516)<br />
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)<br />
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)<br />
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
at java.lang.reflect.Method.invoke(Method.java:597)<br />
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)<br />
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)<br />
Caused by: java.sql.BatchUpdateException: Duplicate entry '725-3' for key 'PRIMARY'<br />
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1693)<br />
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1108)<br />
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:299)<br />
at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:880)<br />
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:590)<br />
... 33 more<br />
01.05.2010 22:49:30 org.apache.catalina.core.StandardContext listenerStop<br />
SCHWERWIEGEND: Exception sending context destroyed event to listener instance of class com.serotonin.mango.MangoContextListener<br />
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [insert into userEvents (eventId, userId, silenced) values (?,?,?)]; Duplicate entry '726-3' for key 'PRIMARY'; nested exception is java.sql.BatchUpdateException: Duplicate entry '726-3' for key 'PRIMARY'<br />
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:292)<br />
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:606)<br />
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:618)<br />
at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:865)<br />
at com.serotonin.mango.db.dao.EventDao.insertUserEvents(EventDao.java:121)<br />
at com.serotonin.mango.rt.EventManager.raiseEvent(EventManager.java:115)<br />
at com.serotonin.mango.rt.event.type.SystemEventType.raiseEvent(System</p>
<p dir="auto">I havent logged in for a longer period so there is a overflow????</p>
<p dir="auto">Any idea where to look?</p>
<p dir="auto">Arne</p>
]]></description><link>https://forum.mango-os.com/topic/385/error-on-startup-key-primary-in-userevents</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 13:51:02 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/385.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 May 2010 20:55:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Error on Startup: key PRIMARY in userEvents on Thu, 06 May 2010 15:00:23 GMT]]></title><description><![CDATA[<p dir="auto">running the script line by line in MYSQL Query Browser fixes the database.</p>
<p dir="auto">If you want me to test this with the next release post me a rc of that.</p>
<p dir="auto">So I consider this bug as closed.</p>
<p dir="auto">Arne</p>
]]></description><link>https://forum.mango-os.com/post/3718</link><guid isPermaLink="true">https://forum.mango-os.com/post/3718</guid><dc:creator><![CDATA[apl]]></dc:creator><pubDate>Thu, 06 May 2010 15:00:23 GMT</pubDate></item><item><title><![CDATA[Reply to Error on Startup: key PRIMARY in userEvents on Thu, 06 May 2010 13:36:06 GMT]]></title><description><![CDATA[<p dir="auto">Yes, there should have been a type=InnoDB in there. I've added this script to the db upgrade for the next version:</p>
<pre><code>
alter table userEvents engine=InnoDB;
delete from userEvents where eventId not in (select id from events);
delete from userEvents where userId not in (select id from users);
alter table userEvents add constraint userEventsFk1 foreign key (eventId) references events(id) on delete cascade;
alter table userEvents add constraint userEventsFk2 foreign key (userId) references users(id) on delete cascade;

</code></pre>
]]></description><link>https://forum.mango-os.com/post/3715</link><guid isPermaLink="true">https://forum.mango-os.com/post/3715</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Thu, 06 May 2010 13:36:06 GMT</pubDate></item><item><title><![CDATA[Reply to Error on Startup: key PRIMARY in userEvents on Thu, 06 May 2010 08:55:20 GMT]]></title><description><![CDATA[<p dir="auto">It looks that MYISAM does not suppport foreign keys <a href="http://orums.mysql.com/read.php?21,213549,213549" rel="nofollow ugc">orums.mysql.com/read.php?21,213549,213549</a></p>
<p dir="auto">so maybe run a script on 1.8.3 if mysql db is used.<br />
Switch that table to innodb and try to create the foreign keys that are missing (at least in my db, which I have restored from backups).</p>
<p dir="auto">Arne</p>
]]></description><link>https://forum.mango-os.com/post/3714</link><guid isPermaLink="true">https://forum.mango-os.com/post/3714</guid><dc:creator><![CDATA[apl]]></dc:creator><pubDate>Thu, 06 May 2010 08:55:20 GMT</pubDate></item><item><title><![CDATA[Reply to Error on Startup: key PRIMARY in userEvents on Thu, 06 May 2010 08:40:07 GMT]]></title><description><![CDATA[<p dir="auto">It 5.1.41 and the version in ubuntu 09.10</p>
<p dir="auto">maybe its that the table userEvents is a myISAM Table.<br />
The statement type=InnoDB on the table in line 274 createTables-mysql.sql is missing - bug/typo?.</p>
<p dir="auto">Arne</p>
]]></description><link>https://forum.mango-os.com/post/3713</link><guid isPermaLink="true">https://forum.mango-os.com/post/3713</guid><dc:creator><![CDATA[apl]]></dc:creator><pubDate>Thu, 06 May 2010 08:40:07 GMT</pubDate></item><item><title><![CDATA[Reply to Error on Startup: key PRIMARY in userEvents on Tue, 04 May 2010 14:12:41 GMT]]></title><description><![CDATA[<p dir="auto">There should be a foreign key between events and eventUsers, so having event ids values in the latter not in the former should not have been possible. What version of MySQL are you using? I believe older versions didn't enforce constraints completely.</p>
]]></description><link>https://forum.mango-os.com/post/3705</link><guid isPermaLink="true">https://forum.mango-os.com/post/3705</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Tue, 04 May 2010 14:12:41 GMT</pubDate></item><item><title><![CDATA[Reply to Error on Startup: key PRIMARY in userEvents on Tue, 04 May 2010 08:45:48 GMT]]></title><description><![CDATA[<p dir="auto">Yes,</p>
<p dir="auto">This is mysql the numbers in userEvent ar much higher than the numbers in evnets so it will insert numbers in userEvents, which already.</p>
<p dir="auto">After deleting all values in userEvents and Events its running. Ive got a backup ;-)</p>
<p dir="auto">Arne</p>
]]></description><link>https://forum.mango-os.com/post/3698</link><guid isPermaLink="true">https://forum.mango-os.com/post/3698</guid><dc:creator><![CDATA[apl]]></dc:creator><pubDate>Tue, 04 May 2010 08:45:48 GMT</pubDate></item><item><title><![CDATA[Reply to Error on Startup: key PRIMARY in userEvents on Sun, 02 May 2010 23:18:45 GMT]]></title><description><![CDATA[<p dir="auto">The keys that were being inserted (726-3, representing eventId and userId) are very small - very unlikely there is any kind of overflow going on. Is this MySQL?</p>
]]></description><link>https://forum.mango-os.com/post/3690</link><guid isPermaLink="true">https://forum.mango-os.com/post/3690</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Sun, 02 May 2010 23:18:45 GMT</pubDate></item></channel></rss>