Urgent help needed - Confluence fails to start after failed backup import
Asked by Rogerio Richa:

I have been running confluence 6.0.3 for years now and this morning I had to restore a backup from last Friday due to an accidental space deletion. When I restored the backup from the platform, I got an error saying: backup failed - failed to run script.

The problem is now I get

org.apache.velocity.exception.MethodInvocationException: Invocation of method 'isShowSignUp' in class com.atlassian.confluence.user.actions.LoginAction threw exception java.lang.NullPointerException: Application cannot be null at /login.vm\[line 6, column 28\]  
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)

caused by: java.lang.NullPointerException: Application cannot be null  
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:226)

when I open the page. I cannot sign in anymore. All similar reports recommend changes to the database (e.g. <https://confluence.atlassian.com/confkb/confluence-returns-system-error-due-to-invocation-of-method-isshowsignup-in-class-com-atlassian-confluence-user-actions-loginaction-threw-exception-java-lang-nullpointerexception-at-login-vm-693899125.html>) but all these fields are empty on mine! It is as if my database had been wiped out.

Can someone please instruct me on how to restore my data? I have a 9GByte backup file which means all relevant data is in there.


Answers:
author: Jennifer Ward
body: Hi Rogerio,

Can you provide the list of steps in the order you performed? I am trying to piece together from everything you have put here, but I want to ensure I am piecing it together properly. I have run into this same issue and am having no luck with the other 'fixes'- my results from cwd_app_directory_mapping are '0' (zero) as well.. Thanks!


author: Shannon S
body: Hello Rogerio,

Thank you for reaching out! I'm happy to help you resolve this issue and get you back up and running.

1. Can you let me know how the backup was created that you are using? Is it a full XML backup of the site, or a database backup?
2. What type of database are you using for Confluence?

If you have a full site XML backup, could you attempt to create a brand-new Confluence installation with a clean database, and restore the XML backup to that once set up?

And because of the [recent security advisory](https://confluence.atlassian.com/doc/confluence-security-advisory-2019-03-20-966660264.html), we recommend that you upgrade now to one of the following versions:

* 6.14.2
* 6.13.3
* 6.6.12

Once you get Confluence back up and running, I would advise you proceed with that upgrade as soon as you can.

Regards,

Shannon

comments: author: Rogerio Richa
body: Hi Shannon,

I'm on PostGres. I was running 6.0.3 and upgraded to the latest but I still have a snapshot of my server from right after the failed upgrade.

To answer your question: the backup was created using the automated backup tool (which runs daily with backups being sent to AWS S3). It is a large .zip file (9 GBytes). I am not sure if this is what you mean by full XML backup.

I did not backup the postgres database when I imported the backup.

And some progress on my problem - I have used those two links to re-create the necessary entries on my DB to allow me to sign in with admin/admin, but I can't see any of my spaces. It is as if I had lost all data. I have tried this on 6.0.3 and 6.15 with the same result.

I've tried re-indexing but no luck so far.


author: Rogerio Richa
body: I'm now taking a different approach - instead of recovering the server, I'll try to "fix" the backup file. I'm now testing <https://jira.atlassian.com/browse/CONFSERVER-38089> on a fresh 6.15 install


author: Shannon S
body: Rogerio,

Thank you for letting me know about that. The 9GB size is quite large so it is probably the full site backup (and not a single space) which includes attachments.

Let me know how the new approach goes. Were you able to test the same backup on a new site installation earlier? That might be your 2nd option to try if you haven't yet.

Regards,

Shannon


author: Rogerio Richa
body: I gave up trying to recover my instance after the failed backup. As I said, I can repopulate the missing DB entries but I end up with no spaces.

So instead I am trying to recover the backup on a fresh 6.15 install. I have tried

<https://jira.atlassian.com/browse/CONFSERVER-38089>

with no luck, then I've moved on to

<https://confluence.atlassian.com/confkb/incorrect-string-value-error-thrown-when-restoring-xml-backup-in-confluence-777009599.html>

where I used a .jar you have provided to clean my entities.xml file, and now I am stuck with a

++Import failed. Check your server logs for more information. 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 '' for key 'unq_lwr_username'++

Still no luck with the problem above. I'm on attempt #35. I've been working flat out on this bc the entire company depends on Confluence. The local Atlassian partner still hasn't phoned me back. Guess I scared them with this post :)

Any help with the problem above will be most welcome. Every time I have to modify entities.xml and re-zip everything it takes several minutes (it is a 9Gbyte file). Any tips that could help me would be most welcome.


author: Rogerio Richa
body: I'm having to resort to trial and error. I got this error during my last attempt

```
2019-04-17 02:56:49,282 ERROR [Long running task: Importing data] [engine.jdbc.spi.SqlExceptionHelper] logExceptions Duplicate entry '' for key 'unq_lwr_username'
-- url: /longrunningtaskxml.action | referer: http://confluence.seecrypt.net:8090/admin/restore-local-file.action | traceId: 6d269534a9d256ec | userName: admin | action: longrunningtaskxml
2019-04-17 02:56:49,376 ERROR [Long running task: Importing data] [confluence.importexport.xmlimport.DefaultImportProcessor] persist Error while saving object: Imported[com.atlassian.confluence.user.ConfluenceUserImpl] [Id[key]=8ae4838a497aef7f01497b1fe7510041, Property[name]=chris.kieser, Property[lowerName]=]
-- url: /longrunningtaskxml.action | referer: http://confluence.seecrypt.net:8090/admin/restore-local-file.action | traceId: 6d269534a9d256ec | userName: admin | action: longrunningtaskxml
2019-04-17 02:56:49,381 ERROR [Long running task: Importing data] [confluence.importexport.xmlimport.BackupImporter] importEntities Cannot import the entities:
-- url: /longrunningtaskxml.action | referer: http://confluence.seecrypt.net:8090/admin/restore-local-file.action | traceId: 6d269534a9d256ec | userName: admin | 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 '' for key 'unq_lwr_username'
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImportInternal(DefaultXmlImporter.java:67)
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImport(DefaultXmlImporter.java:49)
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:169)
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:333)
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:282)
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:213)
at com.sun.proxy.$Proxy217.performImport(Unknown Source)
at com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:58)
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:93)
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImportInternal(DefaultXmlImporter.java:58)
... 41 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:234)
at com.atlassian.confluence.importexport.xmlimport.ImportProcessorContext.objectImported(ImportProcessorContext.java:87)
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)
... 53 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '' 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:3978)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
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:2495)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2124)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2058)
at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5158)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2043)
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)
... 59 more
```


author: Rogerio Richa
body: I'm resorting to trial and error now. I got this on my last import attempt.

```
2019-04-17 02:56:49,282 ERROR [Long running task: Importing data] [engine.jdbc.spi.SqlExceptionHelper] logExceptions Duplicate entry '' for key 'unq_lwr_username'
-- url: /longrunningtaskxml.action | referer: http://confluence.seecrypt.net:8090/admin/restore-local-file.action | traceId: 6d269534a9d256ec | userName: admin | action: longrunningtaskxml
2019-04-17 02:56:49,376 ERROR [Long running task: Importing data] [confluence.importexport.xmlimport.DefaultImportProcessor] persist Error while saving object: Imported[com.atlassian.confluence.user.ConfluenceUserImpl] [Id[key]=8ae4838a497aef7f01497b1fe7510041, Property[name]=chris.kieser, Property[lowerName]=]
-- url: /longrunningtaskxml.action | referer: http://confluence.seecrypt.net:8090/admin/restore-local-file.action | traceId: 6d269534a9d256ec | userName: admin | action: longrunningtaskxml
2019-04-17 02:56:49,381 ERROR [Long running task: Importing data] [confluence.importexport.xmlimport.BackupImporter] importEntities Cannot import the entities:
-- url: /longrunningtaskxml.action | referer: http://confluence.seecrypt.net:8090/admin/restore-local-file.action | traceId: 6d269534a9d256ec | userName: admin | 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 '' for key 'unq_lwr_username'
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImportInternal(DefaultXmlImporter.java:67)
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImport(DefaultXmlImporter.java:49)
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:169)
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:333)
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:282)
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:213)
at com.sun.proxy.$Proxy217.performImport(Unknown Source)
at com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:58)
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:93)
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImportInternal(DefaultXmlImporter.java:58)
... 41 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:234)
at com.atlassian.confluence.importexport.xmlimport.ImportProcessorContext.objectImported(ImportProcessorContext.java:87)
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)
... 53 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '' 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:3978)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
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:2495)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2124)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2058)
at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5158)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2043)
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)
... 59 more
```

I've grepped that ID 8ae4838a497aef7f01497b1fe7510041

```
grep -n '8ae4838a497aef7f01497b1fe7510041' entities.xml 
3798577:<property name="user" class="ConfluenceUserImpl" package="com.atlassian.confluence.user"><id name="key"><![CDATA[8ae4838a497aef7f01497b1fe7510041]]></id>
3803721:<id name="key"><![CDATA[8ae4838a497aef7f01497b1fe7510041]]></id>
```

and I am now trying to remove taht entry around line 3803721

<br />

awk 'FNR\>=3803701 \&\& FNR\<=3803741' entities.xml

```

<property name="sequence">259</property>
<property name="event">042cf3f9eee3baf6e5f2f3e9efee8129f3f9eee3bae4e1f4e144182d8108169e13a037caebdaeccbccb8b6eed9d7cab9d3d7ecb4e4b6cdf8f7d94d8180128114a0de9f80a84c7f9613948114931295c3918870de129a21e41295811295c1128638b2b0b1b7adb0b3adb1b0d4b1b3bab5b4bab4b5aeb3b0b5da158327f5f3e5f2cbe5f959a0b8e1b8e3b8b2b8e2b5b9b4b3b7e2e2b1b0b1b5b9b4b6b1b4b3b4b9b4b0b0b0b326e2f2e1eee3e826ede1f3f4e5f22ff3f9eee3bae3efedf0f2e5f3f3e5e426d3cec1d0d0d92ef3f9eee3bae5eee3f2f9f0f4e5e442</property>
</object>
<object class="Events" package="com.atlassian.synchrony">
<composite-id><property name="rev" type="string"><![CDATA[bjty8VC8AVWfPS6C9ri27N8.265]]></property>
<property name="history" type="string"><![CDATA[/Synchrony-914a04ef-be34-31c6-ac88-ea76dff7595a/confluence-15761958]]></property>
</composite-id>
<property name="partition">4</property>
<property name="sequence">266</property>
<property name="event">042cf3f9eee3baf6e5f2f3e9efee8129f3f9eee3bae4e1f4e14445608108169e13a037e2eaf4f9b8d6c3b8c1d6d7e6d0d3b6c3b9f2e9b2b7ceb84d8189128114a0e69f804888841394811493129586139482139425e3ece1f3f3139959aff2e5ece1f4e9f6e5adf4e1e2ece5a0e3efeee6ecf5e5eee3e5d4859084e1e3859d90f2e5f3e9fa8191881295818183208638b2b0b1b7adb0b3adb2b7d4b1b8bab5b8bab1b1aeb8b6b5da158327f5f3e5f2cbe5f959a0b0b0b0858214b5b4b5b3b4e3b7b0b0b1b5b4b8b6b7b2b8e2b7b6b0b0b0b126e2f2e1eee3e826ede1f3f4e5f22ff3f9eee3bae3efedf0f2e5f3f3e5e426d3cec1d0d0d92ef3f9eee3bae5eee3f2f9f0f4e5e442</property>
</object>
<object class="Events" package="com.atlassian.synchrony">
<composite-id><property name="rev" type="string"><![CDATA[I4Owaz8zZHSWTD6o7y9YeBI.253]]></property>
<property name="history" type="string"><![CDATA[/Synchrony-914a04ef-be34-31c6-ac88-ea76dff7595a/confluence-15762015]]></property>
</composite-id>
<property name="partition">0</property>
<property name="sequence">300</property>
<property name="event">042cf3f9eee3baf6e5f2f3e9efee8129f3f9eee3bae4e1f4e14412288100169e13a037c9b4cff7e1fab8fadac8d3d7d4c4b6efb7f9b9d9e5c2c94c7d128114e69e80a47c8013948113931295898d8870db8a129a23ec4220128638b2b0b1b7adb0b3adb2b9d4b0b6bab5b3bab2b3aeb1b5b3da158327f5f3e5f2cbe5f959a0b8e1b8e3b8b2b8e2b5b9b4b3b7e2e2b1b0b1b5b9b4b6b1b4b3b4b9b4b0b0b0b326e2f2e1eee3e826ede1f3f4e5f22ff3f9eee3bae3efedf0f2e5f3f3e5e426d3cec1d0d0d92ef3f9eee3bae5eee3f2f9f0f4e5e442</property>
</object>
<object class="ConfluenceUserImpl" package="com.atlassian.confluence.user">
<id name="key"><![CDATA[8ae4838a497aef7f01497b1fe7510041]]></id>
<property name="name"><![CDATA[chris.kieser]]></property>
<property name="lowerName"/></object>
<object class="Events" package="com.atlassian.synchrony">
<composite-id><property name="rev" type="string"><![CDATA[2kxTSntf35aMcWicpTnMda8.9]]></property>
<property name="history" type="string"><![CDATA[/Synchrony-914a04ef-be34-31c6-ac88-ea76dff7595a/confluence-11602193]]></property>
</composite-id>
<property name="partition">0</property>
<property name="sequence">11</property>
<property name="event">042cf3f9eee3baf6e5f2f3e9efee8129f3f9eee3bae4e1f4e144283b81fc169e13a037b2ebf8d4d3eef4e6b3b5e1cde3d7e9e3f0d4eecde4e1b889128114e29d8070d688801394811493129587139482139425e3ece1f3f313992fe3efeee6ecf5e5eee3e5d4e1e2ece512958112958a128638b2b0b1b7adb0b1adb0b5d4b1b5bab1b6bab2b7aeb6b7b5da158327f5f3e5f2cbe5f959a0b0b0b0858214b5b4b5b3b4e3b7b0b0b1b5b4b8b6b7b2b8e2b7b6b0b0b0b126e2f2e1eee3e826ede1f3f4e5f22ff3f9eee3bae3efedf0f2e5f3f3e5e426d3cec1d0d0d92ef3f9eee3bae5eee3f2f9f0f4e5e442</property>
</object>
<object class="Events" package="com.atlassian.synchrony">
<composite-id><property name="rev" type="string"><![CDATA[DjrXTA3lBIhBzxOLyGg4rog.312]]></property>
<property name="history" type="string"><![CDATA[/Synchrony-914a04ef-be34-31c6-ac88-ea76dff7595a/confluence-6169081]]></property>
</composite-id>
<property name="partition">0</property>
<property name="sequence">313</property>
<property name="event">042cf3f9eee3baf6e5f2f3e9efee8129f3f9eee3bae4e1f4e1441b318108169e13a037c4eaf2d8d4c1b3ecc2c9e8c2faf8cfccf9c7e7b4f2efe74d81b8128114a0e69f80a4b78013948114931295a18d8870e298129a22e4e912954d81ad129595128638b2b0b1b7adb0b3adb1b0d4b1b5bab4b4bab0b2aeb7b1b9da158327f5f3e5f2cbe5f959a0b8e1b8e3b8b2b8e2b5b9b4b3b7e2e2b1b0b1b5b9b4b6b1b4b3b4b9b4b0b0b0b326e2f2e1eee3e826ede1f3f4e5f22ff3f9eee3bae3efedf0f2e5f3f3e5e426d3cec1d0d0d92ef3f9eee3bae5eee3f2f9f0f4e5e442</property>
</object>
<object class="Events" package="com.atlassian.synchrony">
<composite-id><property name="rev" type="string"><![CDATA[W7N2SIMWqgF9xvSDWRTVui4.7]]></property>
```

But I don't know if this is the right way to do it. Could someone please point me to some reading material ? any help would be welcome. Still, 2 days in and no technical support. Where can I raise this bug to a more serious support level?


author: Rogerio Richa
body: So it turns out removing that offending \<property\> fixed the problem. Cavemen debugging always works. Still no call back from my Atlassian Partner.


author: Shannon S
body: Hi Rogerio,

My apologies, I think we might be on a different timezone because most of your responses come in after-hours for me.

Can you confirm if removing the property fixed the entire issue, or if you are still having specific issues? If so, I would like to create an issue in our support system so you can start sending us entire log files.

Regards,

Shannon


author: Rogerio Richa
body: Hi Shannon - Removing the \<property\> allowed me to import the backup. An important note: I also had to run that perl script and that .jar to rid entities.xml of inconsistencies.

I have to say, it was one of the biggest scares I've had in years.


author: Shannon S
body: Rogerio,

I'm relieved to hear that! Thank you for confirming the fix.

I can imagine how scary that would be to be running Confluence for so long, with the aspect of losing your data!

As long as you have a valid backup, believe be rest assured we can help you through any crisis. When you create a new question on the Community, our support team is also notified and can reach out to you.

Take care, and have a pleasant weekend.

Regards,

Shannon


author: Nirmani Kalakheti
body: [@Rogerio Richa](/t5/user/viewprofilepage/user-id/128254) , can you provide the steps you took? Step by step if possible.


author: Rogerio Richa
body: I'm currently trying to reconstruct these tables in my DB using instructions from

<https://confluence.atlassian.com/confkb/unable-to-log-in-to-confluence-715261580.html>

and

<https://confluence.atlassian.com/confkb/how-to-recreate-the-confluence-internal-user-directories-776657338.html>

but so far no luck. I believe there are some conflicting directory/application IDs on these two documents so I would appreciate a hand here.