cancel
Showing results for 
Search instead for 
Did you mean: 

Migration Problem 3.0.0b to 3.4d 'Duplicate entry'

olafprecht
Champ in-the-making
Champ in-the-making
We have trouble with the alfresco migration by one of our customers

We updated from 3.0.0b to 3.4d

Due to the automatic migration-process while the first start of the tomcat with the new version, we get following log-output. the alfresco didn't start, and is not reachable over the web-frontend.

It seems to be a problem with the update in the temporary table "t_alf_node_aspects". The run of the INSERT-Statement doesn't produce a duplicate key. We think, that the script or even the statement runs twice, so the duplicate key occurs.

Why is a script "upgrade-from-2.2SP1.sql" running, while we are updating from 3.0.0?


10:38:29,722  INFO  [alfresco.config.JndiPropertiesFactoryBean] Loading properties file from class path resource [alfresco/repository.properties]

10:38:29,738  INFO  [alfresco.config.JndiPropertiesFactoryBean] Loading properties file from class path resource [alfresco/domain/transaction.properties]

10:38:29,738  INFO  [alfresco.config.JndiPropertiesFactoryBean] Loading properties file from file [C:\Program Files (x86)\PDS\PolarisOne\tomcat\temp\0-alfresco\WEB-INF\classes\alfresco\module\test\alfresco-global.properties]

10:38:29,738  INFO  [alfresco.config.JndiPropertiesFactoryBean] Loading properties file from file [C:\Program Files (x86)\PDS\PolarisOne\tomcat\temp\0-alfresco\WEB-INF\classes\alfresco\module\tests\alfresco-global.properties]

10:38:29,738  INFO  [alfresco.config.JndiPropertiesFactoryBean] Loading properties file from URL [file:/C:/Program%20Files%20(x86)/PDS/PolarisOne/tomcat/shared/classes/alfresco-global.properties]

10:38:29,800  INFO  [alfresco.config.JndiPropertyPlaceholderConfigurer] Loading properties file from class path resource [alfresco/alfresco-shared.properties]

10:38:29,894  INFO  [alfresco.config.FixedPropertyPlaceholderConfigurer] Loading properties file from class path resource [alfresco/version.properties]

10:38:29,925  INFO  [alfresco.config.FixedPropertyPlaceholderConfigurer] Loading properties file from class path resource [alfresco/domain/cache-strategies.properties]

10:38:44,972  INFO  [extensions.webscripts.TemplateProcessorRegistry] Registered template processor Repository Template Processor for extension ftl

10:38:44,988  INFO  [extensions.webscripts.ScriptProcessorRegistry] Registered script processor Repository Script Processor for extension js

10:38:50,004  INFO  [domain.schema.SchemaBootstrap] Schema managed by database dialect org.hibernate.dialect.MySQLInnoDBDialect.

10:38:51,160  ERROR [domain.schema.SchemaBootstrap] Failed to dump normalized, pre-upgrade schema to file.  Error: java.io.FileNotFoundException: C:\Program%20Files%20(x86)\PDS\PolarisOne\tomcat\temp\Alfresco\AlfrescoSchema-MySQLInnoDBDialect-1953550943209395128-Startup.xml (Das System kann den angegebenen Pfad nicht finden)

10:38:51,207  INFO  [domain.schema.SchemaBootstrap] Executing database script C:\Program Files (x86)\PDS\PolarisOne\tomcat\temp\Alfresco\AlfrescoSchema-MySQLInnoDBDialect-Update-1690312133470676700.sql (Copied from classpath:alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.MySQLInnoDBDialect/upgrade-from-2.2SP1.sql).

10:38:56,316  ERROR [domain.schema.SchemaBootstrap] Statement execution failed:
   SQL: INSERT INTO t_alf_node_aspects
   (
      node_id, qname_id
   )
   SELECT
      na.node_id,
      qname_id
   FROM
      alf_node_aspects na
      JOIN alf_qname qn ON (na.qname_id = qn.id)
      JOIN alf_namespace ns ON (qn.ns_id = ns.id)
   WHERE
      ns.uri != 'http://www.alfresco.org/model/system/1.0' OR
      qn.local_name != 'referenceable'
      AND na.node_id >= 10000 AND na.node_id <= 19999

   Error: Duplicate entry '607-109' for key 'PRIMARY'
   File: C:\Program Files (x86)\PDS\PolarisOne\tomcat\temp\Alfresco\AlfrescoSchema-MySQLInnoDBDialect-Update-1690312133470676700.sql
   Line: 269

10:38:56,316  ERROR [domain.schema.SchemaBootstrap] Schema auto-update failed

com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '607-109' for key 'PRIMARY'

   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

   at java.lang.reflect.Constructor.newInstance(Unknown Source)

   at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)

   at com.mysql.jdbc.Util.getInstance(Util.java:382)

   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)

   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)

   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)

   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)

   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)

   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)

   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2570)

   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:779)

   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:622)

   at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

   at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.executeStatement(SchemaBootstrap.java:1203)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.executeScriptFile(SchemaBootstrap.java:1153)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.executeScriptUrl(SchemaBootstrap.java:880)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.checkSchemaPatchScripts(SchemaBootstrap.java:851)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.updateSchema(SchemaBootstrap.java:754)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1363)

   at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)

   at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)

   at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:78)

   at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:294)

   at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:858)

   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:419)

   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)

   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)

   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)

   at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)

   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)

   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)

   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)

   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)

   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)

   at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)

   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)

   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)

   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)

   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)

   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)

   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

   at org.apache.catalina.core.StandardService.start(StandardService.java:516)

   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)

   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

   at java.lang.reflect.Method.invoke(Unknown Source)

   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

10:38:56,316  ERROR [web.context.ContextLoader] Context initialization failed

org.alfresco.error.AlfrescoRuntimeException: 04310000 Schema auto-update failed

   at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1492)

   at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)

   at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)

   at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:78)

   at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:294)

   at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:858)

   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:419)

   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)

   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)

   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)

   at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)

   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)

   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)

   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)

   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)

   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)

   at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)

   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)

   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)

   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)

   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)

   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)

   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

   at org.apache.catalina.core.StandardService.start(StandardService.java:516)

   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)

   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

   at java.lang.reflect.Method.invoke(Unknown Source)

   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '607-109' for key 'PRIMARY'

   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

   at java.lang.reflect.Constructor.newInstance(Unknown Source)

   at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)

   at com.mysql.jdbc.Util.getInstance(Util.java:382)

   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)

   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)

   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)

   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)

   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)

   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)

   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2570)

   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:779)

   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:622)

   at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

   at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.executeStatement(SchemaBootstrap.java:1203)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.executeScriptFile(SchemaBootstrap.java:1153)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.executeScriptUrl(SchemaBootstrap.java:880)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.checkSchemaPatchScripts(SchemaBootstrap.java:851)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.updateSchema(SchemaBootstrap.java:754)

   at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1363)

   … 34 more

1 REPLY 1

olafprecht
Champ in-the-making
Champ in-the-making
The Problem was in the Update-Script.

The INSERT-Statement beginning in Line 254 runs more than once, depending of the amount of data-rows (that was the reason, the error occured only at one customer)

The where-Clause has an "OR"-Part and it wasn't put in parentheses.

Accordng to the svn, there was already a fix from "davew" on 11.04.2011, which wasn't part of our Installation

New Code:

INSERT INTO t_alf_node_aspects
   (
      node_id, qname_id
   )
   SELECT
      na.node_id,
      qname_id
   FROM
      alf_node_aspects na
      JOIN alf_qname qn ON (na.qname_id = qn.id)
      JOIN alf_namespace ns ON (qn.ns_id = ns.id)
   WHERE
      (ns.uri != 'http://www.alfresco.org/model/system/1.0' OR
      qn.local_name != 'referenceable')
      AND na.node_id >= ${LOWERBOUND} AND na.node_id <= ${UPPERBOUND}
;