-
Bug
-
Resolution: Fixed
-
Highest
-
6.0.1, 1000.518.0, 7.10.2, 7.13.0
-
172
-
Severity 2 - Major
-
194
-
We don't plan to backport the fix for this bug to earlier Long Term Support versions
The fix for this bug isn't suitable for backporting to a bug fix release for any previous LTS versions. This is often because the fix is considered too high risk to implement in an older version.
The fix for this issue will be included in future Long Term Support versions.
NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.
Summary
Space imports to Confluence Cloud and Server are failing with the following error message displayed on the UI:
Import failed. Check your server logs for more information. com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: org.hibernate.exception.ConstraintViolationException: could not execute statement
Environment
- Confluence Cloud 1000.518.1
Steps to Reproduce
- Create two spaces, ABC and DEF
- Create a Page "Parent" on space ABC
- Create a draft under "Parent" on space ABC but don't publish it
- Move "Parent" to space DEF
- Do a space export of space ABC, the export has both spaces ABC and DEF
- Attempt to import into Confluence Cloud, and it fails to import if Confluence already has DEF space
Expected Results
The space is imported successfully into Confluence Cloud.
Actual Results
The space failed with the error message mentioned above.
com.atlassian.confluence.importexport.ImportExportException: com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: org.hibernate.exception.ConstraintViolationException: could not execute statement at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEntities(BackupImporter.java:416) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEverything(BackupImporter.java:377) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:145) at com.atlassian.confluence.importexport.xmlimport.BackupImporter$1.doInTransactionWithoutResult(BackupImporter.java:263) 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:225) at com.atlassian.confluence.importexport.Importer.doImport(Importer.java:75) at com.atlassian.confluence.importexport.DefaultImportExportManager.performImportInternal(DefaultImportExportManager.java:96) at com.atlassian.confluence.importexport.DefaultImportExportManager.doPerformImport(DefaultImportExportManager.java:87) at com.atlassian.confluence.importexport.DefaultImportExportManager.performImport(DefaultImportExportManager.java:82) 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.$Proxy142.performImport(Unknown Source) at com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:68) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:45) 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:89) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:49) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:87) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:77) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:48) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:65) 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:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: org.hibernate.exception.ConstraintViolationException: could not execute statement at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImport(DefaultXmlImporter.java:67) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEntities(BackupImporter.java:408) ... 39 more Caused by: org.xml.sax.SAXException: Error while importing backup: org.hibernate.exception.ConstraintViolationException: could not execute statement net.sf.hibernate.HibernateException: org.hibernate.exception.ConstraintViolationException: could not execute statement 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:89) at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImport(DefaultXmlImporter.java:54) ... 40 more Caused by: net.sf.hibernate.HibernateException: org.hibernate.exception.ConstraintViolationException: could not execute statement 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.HibernateImportProcessorContext.flushIfNeeded(HibernateImportProcessorContext.java:174) at com.atlassian.confluence.importexport.xmlimport.HibernateImportProcessorContext.objectImported(HibernateImportProcessorContext.java:59) 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: org.hibernate.exception.ConstraintViolationException: could not execute statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:207) at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2934) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3434) at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:582) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:456) 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 Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "uk_jp1ad5yufsih5r7lqrygakpug" at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363) at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.github.gquintana.metrics.proxy.MethodInvocation.proceed(MethodInvocation.java:75) at com.github.gquintana.metrics.sql.PreparedStatementProxyHandler.execute(PreparedStatementProxyHandler.java:55) at com.github.gquintana.metrics.sql.AbstractStatementProxyHandler.invoke(AbstractStatementProxyHandler.java:61) at com.github.gquintana.metrics.proxy.ProxyHandler.invoke(ProxyHandler.java:73) at com.sun.proxy.$Proxy579.executeUpdate(Unknown Source) at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.vibur.dbcp.proxy.AbstractInvocationHandler.targetInvoke(AbstractInvocationHandler.java:153) at org.vibur.dbcp.proxy.StatementInvocationHandler.processExecute(StatementInvocationHandler.java:141) at org.vibur.dbcp.proxy.StatementInvocationHandler.restrictedInvoke(StatementInvocationHandler.java:83) at org.vibur.dbcp.proxy.StatementInvocationHandler.restrictedInvoke(StatementInvocationHandler.java:40) at org.vibur.dbcp.proxy.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80) at com.sun.proxy.$Proxy579.executeUpdate(Unknown Source) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204) ... 67 more
Additional information and workaround
The "could not execute statement" message is a symptom for several bugs which made database inconsistent. This ticket is about the invalid drafts issue. It was solved, but we still have several other similar issues which will need to be resolved for a comprehensive solution:
- https://jira.atlassian.com/browse/CONFSERVER-55364
- https://jira.atlassian.com/browse/CONFSERVER-55365
- https://jira.atlassian.com/browse/CONFSERVER-55366
There is a workaround which allows to fix database inconsistency for all these 3 tickets: https://confluence.atlassian.com/confkb/importing-a-space-fails-with-could-not-execute-statement-error-in-confluence-server-949242294.html
- is detailed by
-
CONFCLOUD-54616 Moving a Page to a new Space doesn't Move it's Unsaved Draft Children and breaks Space Export
- Closed
- is related to
-
CONFCLOUD-64563 Space export may export multiple spaces
- Closed
-
CONFSERVER-55364 A historical version of the content could have a different parent
- Closed
-
CONFSERVER-55365 An attachment and its container could be related to different spaces
- Closed
-
CONFSERVER-55366 Space import fails if a custom content and its container are assigned to different spaces
- Closed
- relates to
-
CONFCLOUD-45278 Space import failing with the error message "could not execute statement"
- Closed
-
CONFCLOUD-64563 Space export may export multiple spaces
- Closed
-
PSR-223 Loading...
- mentioned in
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...