restore ie error
Asked by qishuowen:

2019-11-01 09:11:26,972 WARN \[Gemini Blueprint context shutdown thread2\] \[beans.factory.support.DisposableBeanAdapter\] destroy Invocation of destroy method failed on bean with name 'defaultLogScanService': java.lang.NullPointerException  
-- url: /setup/longrunningtaskxml.action \| referer: <http://10.100.2.136:8090/setup/setup-restore-local.action> \| traceId: d13ba05b8aa4e09e \| userName: anonymous \| action: longrunningtaskxml  
2019-11-01 09:11:26,987 INFO \[Long running task: Importing data\] \[atlassian.plugin.manager.DefaultPluginManager\] broadcastPluginDisabling Disabling com.atlassian.confluence.plugins.confluence-collaborative-editor-plugin  
2019-11-01 09:11:27,073 INFO \[Long running task: Importing data\] \[atlassian.plugin.manager.DefaultPluginManager\] reenableDependent Found optional/dynamic dependent plugins to re-enable after plugins DISABLED '\[com.atlassian.confluence.plugins.confluence-collaborative-editor-plugin\]': \[com.atlassian.troubleshooting.plugin-confluence(OPTIONAL)\]. Enabling...  
2019-11-01 09:30:03,809 ERROR \[Long running task: Importing data\] \[engine.jdbc.spi.SqlExceptionHelper\] logExceptions Duplicate entry 'admin' for key 'unq_lwr_username'  
-- url: /setup/longrunningtaskxml.action \| referer: <http://10.100.2.136:8090/setup/setup-restore-local.action> \| traceId: d13ba05b8aa4e09e \| userName: anonymous \| action: longrunningtaskxml  
2019-11-01 09:30:03,889 ERROR \[Long running task: Importing data\] \[confluence.importexport.xmlimport.DefaultImportProcessor\] persist Error while saving object: Imported\[com.atlassian.confluence.user.ConfluenceUserImpl\] \[Id\[key\]=c2e022dc6a96a5ae016a96a987b80000, Property\[name\]=admin, Property\[lowerName\]=admin\]  
-- url: /setup/longrunningtaskxml.action \| referer: <http://10.100.2.136:8090/setup/setup-restore-local.action> \| traceId: d13ba05b8aa4e09e \| userName: anonymous \| action: longrunningtaskxml  
2019-11-01 09:30:03,894 ERROR \[Long running task: Importing data\] \[confluence.importexport.xmlimport.BackupImporter\] importEntities Cannot import the entities:  
-- url: /setup/longrunningtaskxml.action \| referer: <http://10.100.2.136:8090/setup/setup-restore-local.action> \| traceId: d13ba05b8aa4e09e \| userName: anonymous \| action: longrunningtaskxml  
com.atlassian.confluence.importexport.ImportExportException: Unable to complete import because the data does not match the constraints in the Confluence schema. Cause: MySQLIntegrityConstraintViolationException: Duplicate entry 'admin' for key 'unq_lwr_username'  
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImport(DefaultXmlImporter.java:60)  
at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEntities(BackupImporter.java:397)  
at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEverything(BackupImporter.java:366)  
at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:160)  
at com.atlassian.confluence.importexport.xmlimport.BackupImporter$1.doInTransactionWithoutResult(BackupImporter.java:258)  
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)  
at com.atlassian.confluence.importexport.xmlimport.RestorePluginStateStoreTransactionCallbackDecorator.doInTransaction(RestorePluginStateStoreTransactionCallbackDecorator.java:46)  
at com.atlassian.confluence.importexport.xmlimport.RestoreBandanaValuesTransactionCallbackDecorator.doInTransaction(RestoreBandanaValuesTransactionCallbackDecorator.java:50)  
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)  
at com.atlassian.confluence.importexport.xmlimport.BackupImporter.doImportInternal(BackupImporter.java:220)  
at com.atlassian.confluence.importexport.Importer.doImport(Importer.java:73)  
at com.atlassian.confluence.importexport.DefaultImportExportManager.performImportInternal(DefaultImportExportManager.java:131)  
at com.atlassian.confluence.importexport.DefaultImportExportManager.doPerformImport(DefaultImportExportManager.java:119)  
at com.atlassian.confluence.importexport.DefaultImportExportManager.performImport(DefaultImportExportManager.java:114)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:498)  
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)  
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)  
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)  
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)  
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)  
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)  
at com.sun.proxy.$Proxy241.performImport(Unknown Source)  
at com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:74)  
at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26)  
at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:52)  
at com.atlassian.confluence.impl.util.concurrent.ConfluenceExecutors$ThreadLocalContextTaskWrapper.lambda$wrap$1(ConfluenceExecutors.java:90)  
at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:50)  
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87)  
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71)  
at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49)  
at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:66)  
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
at java.lang.Thread.run(Thread.java:748)  
Caused by: org.xml.sax.SAXException: Error while importing backup: could not execute statement; sql=n/a  
net.sf.hibernate.exception.ConstraintViolationException: could not execute statement; sql=n/a  
at com.atlassian.confluence.importexport.xmlimport.parser.BackupParser.endElement(BackupParser.java:45)  
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)  
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)  
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)  
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)  
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)  
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)  
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)  
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)  
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)  
at com.atlassian.security.xml.RestrictedXMLReader.parse(RestrictedXMLReader.java:103)  
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.parseBackup(DefaultXmlImporter.java:86)  
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImport(DefaultXmlImporter.java:51)  
... 40 more  
Caused by: net.sf.hibernate.exception.ConstraintViolationException: could not execute statement; sql=n/a  
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:147)  
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155)  
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:162)  
at com.atlassian.hibernate.util.SessionHelper.flushAllowNoTransaction(SessionHelper.java:83)  
at com.atlassian.hibernate.adapter.adapters.session.SessionV2Adapter.flush(SessionV2Adapter.java:135)  
at com.atlassian.confluence.importexport.xmlimport.ImportProcessorContext.flushIfNeeded(ImportProcessorContext.java:228)  
at com.atlassian.confluence.importexport.xmlimport.ImportProcessorContext.objectImported(ImportProcessorContext.java:80)  
at com.atlassian.confluence.importexport.xmlimport.DefaultImportProcessor.persist(DefaultImportProcessor.java:44)  
at com.atlassian.confluence.importexport.xmlimport.DefaultImportProcessor.processObject(DefaultImportProcessor.java:34)  
at com.atlassian.confluence.importexport.xmlimport.parser.BackupParser.endElement(BackupParser.java:43)  
... 52 more  
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'admin' for key 'unq_lwr_username'  
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)  
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)  
at com.mysql.jdbc.Util.getInstance(Util.java:408)  
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)  
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976)  
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912)  
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)  
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)  
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2486)  
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)  
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2079)  
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2013)  
at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5104)  
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1998)  
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)  
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:205)  
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45)  
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3003)  
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3503)  
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89)  
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:586)  
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:460)  
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)  
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)  
at com.atlassian.hibernate.util.SessionHelper.flushAllowNoTransaction(SessionHelper.java:80)  
... 58 more


Answers:
author: Shannon S
body: Hello [@qishuowen](/t5/user/viewprofilepage/user-id/3620077),

Welcome to Atlassian Community. It's nice to have you!

From my understanding, you're attempting to perform some sort of restore. Could you confirm if this is a space restore or an entire site?

You are running into the error from this article:

* [Confluence site XML import fails with "duplicate key" error](https://confluence.atlassian.com/confkb/confluence-site-xml-import-fails-with-duplicate-key-error-438993638.html)

Please give that a try and let me know if it works.

If not, can you tell me the following?

1. What version of Confluence are you restoring to?
2. What version of Confluence are you restoring from?
3. What is your database type and version?
4. Can you confirm that your collation is set to UTF-8 across your filesystem and database?
5. What steps have you taken so far?

Thank you for your follow-up!

Regards,

Shannon