How to fix when confluence page export failed?
Asked by Sekhar Chandra:

Hi All,

We are trying to export some pages of a space in confluence server. For this we are using custom export xml option in content tools option of Space.

But we got error in exporting those pages and found something in the logs.

2019-11-25 08:09:37,584 INFO \[Long running task: Export Space\] \[atlassian.confluence.upgrade.AbstractUpgradeManager\] getExportBuildNumber Build number 4950: "Upgrade to build number: 4950" - Ok  
2019-11-25 08:09:37,584 INFO \[Long running task: Export Space\] \[atlassian.confluence.upgrade.AbstractUpgradeManager\] getExportBuildNumber Build number 4526: "Remove the legacy remotable apps plugin from the user installed plugins" - Ok  
2019-11-25 08:09:37,584 INFO \[Long running task: Export Space\] \[atlassian.confluence.upgrade.AbstractUpgradeManager\] getExportBuildNumber Build number 4517: "Migrate all Page Templates using a storage format round-trip conversion" - Not Ok  
2019-11-25 08:09:37,584 INFO \[Long running task: Export Space\] \[atlassian.confluence.upgrade.AbstractUpgradeManager\] getExportBuildNumber Backward compatibility for export: "Migrate all Page Templates using a storage format round-trip conversion" prevents compatibility before 4517  
2019-11-25 08:11:03,337 WARN \[Long running task: Export Space\] \[hibernate.query.internal.QueryParameterBindingsImpl\] expandListValuedParameters HHH000443: Dialect \[com.atlassian.confluence.impl.hibernate.dialect.SQLServerDialect\] limits the number of elements in an IN predicate to 2100 entries. However, the given parameter list \[exclusions\] contained 2128 entries, which will likely cause failures to execute the query in the database  
-- url: /spaces/doexportspace.action \| referer: <http://confluence-dev.cad.local/spaces/exportspacexml.action?key=BGCTD> \| traceId: ba292304c3ad9c73 \| userName: cb110602 \| action: doexportspace  
2019-11-25 08:11:03,398 ERROR \[Long running task: Export Space\] \[engine.jdbc.spi.SqlExceptionHelper\] logExceptions Prepared or callable statement has more than 2000 parameter markers.  
-- url: /spaces/doexportspace.action \| referer: <http://confluence-dev.cad.local/spaces/exportspacexml.action?key=BGCTD> \| traceId: ba292304c3ad9c73 \| userName: cb110602 \| action: doexportspace  
2019-11-25 08:11:03,414 ERROR \[Long running task: Export Space\] \[confluence.importexport.impl.AbstractXmlExporter\] backupEntities Couldn't backup database data.  
-- url: /spaces/doexportspace.action \| referer: <http://confluence-dev.cad.local/spaces/exportspacexml.action?key=BGCTD> \| traceId: ba292304c3ad9c73 \| userName: cb110602 \| action: doexportspace  
org.springframework.dao.DataIntegrityViolationException: could not prepare statement; SQL \[select TOP(?) user2conte0_.RELATIONID as col_0_0_ from USERCONTENT_RELATION user2conte0_ cross join CONTENT spaceconte1_ where spaceconte1_.CONTENTTYPE in ('PAGE', 'BLOGPOST', 'USERSTATUS', 'SPACEDESCRIPTION', 'MAIL', 'ATTACHMENT', 'CUSTOM') and user2conte0_.TARGETCONTENTID=spaceconte1_.CONTENTID and (case when spaceconte1_.PREVVER is not null then spaceconte1_.PREVVER else spaceconte1_.CONTENTID end in (select spaceconte2_.CONTENTID from CONTENT spaceconte2_ cross join SPACES space3_ where spaceconte2_.CONTENTTYPE in ('PAGE', 'BLOGPOST', 'USERSTATUS', 'SPACEDESCRIPTION', 'MAIL', 'ATTACHMENT', 'CUSTOM') and spaceconte2_.SPACEID=space3_.SPACEID and (spaceconte2_.CONTENTID not in (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)) and space3_.SPACEKEY=?))\]; nested exception is org.hibernate.exception.DataException: could not prepare statement  
at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:245)  
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:366)  
at org.springframework.orm.hibernate5.HibernateTemplate.execute(HibernateTemplate.java:313)  
at com.atlassian.confluence.internal.relations.dao.hibernate.User2ContentHibernateRelationDao.getAllRelationIdsForContentInSpace(User2ContentHibernateRelationDao.java:178)  
at com.atlassian.confluence.importexport.impl.XmlExporterObjectHandleCollector.getUserToContentRelationsFromSpace(XmlExporterObjectHandleCollector.java:204)  
at com.atlassian.confluence.importexport.impl.XmlExporterObjectHandleCollector.addEntityHandlesFromSpace(XmlExporterObjectHandleCollector.java:128)  
at com.atlassian.confluence.importexport.impl.XmlExporterObjectHandleCollector.getObjectHandles(XmlExporterObjectHandleCollector.java:98)  
at com.atlassian.confluence.importexport.impl.XmlExporterObjectHandleCollector.getHandlesOfObjectsForExport(XmlExporterObjectHandleCollector.java:88)  
at com.atlassian.confluence.importexport.impl.XmlExporter.getHandlesOfObjectsForExport(XmlExporter.java:107)  
at com.atlassian.confluence.importexport.impl.AbstractXmlExporter.backupEntities(AbstractXmlExporter.java:193)  
at com.atlassian.confluence.importexport.impl.AbstractXmlExporter.backupEverything(AbstractXmlExporter.java:98)  
at com.atlassian.confluence.importexport.impl.FileXmlExporter.backupEverything(FileXmlExporter.java:95)  
at com.atlassian.confluence.importexport.impl.AbstractXmlExporter.doExport(AbstractXmlExporter.java:92)  
at com.atlassian.confluence.importexport.impl.FileXmlExporter.doExportInternal(FileXmlExporter.java:60)  
at com.atlassian.confluence.importexport.impl.FileXmlExporter.doExport(FileXmlExporter.java:54)  
at com.atlassian.confluence.importexport.impl.XmlExporter.doExport(XmlExporter.java:51)  
at com.atlassian.confluence.importexport.DefaultImportExportManager.doExport(DefaultImportExportManager.java:225)  
at com.atlassian.confluence.importexport.DefaultImportExportManager.exportAs(DefaultImportExportManager.java:191)  
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.$Proxy152.exportAs(Unknown Source)  
at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask$1.doInTransactionWithoutResult(ExportSpaceLongRunningTask.java:145)  
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)  
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)  
at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask.runInternal(ExportSpaceLongRunningTask.java:117)  
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.hibernate.exception.DataException: could not prepare statement  
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:118)  
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.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:182)  
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148)  
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1940)  
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1909)  
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1887)  
at org.hibernate.loader.Loader.doQuery(Loader.java:932)  
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349)  
at org.hibernate.loader.Loader.doList(Loader.java:2615)  
at org.hibernate.loader.Loader.doList(Loader.java:2598)  
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2430)  
at org.hibernate.loader.Loader.list(Loader.java:2425)  
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)  
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:370)  
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)  
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1481)  
at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1441)  
at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1410)  
at com.atlassian.confluence.internal.relations.dao.hibernate.User2ContentHibernateRelationDao.lambda$getAllRelationIdsForContentInSpace$5(User2ContentHibernateRelationDao.java:185)  
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:359)  
... 46 more  
Caused by: java.sql.SQLException: Prepared or callable statement has more than 2000 parameter markers.  
at net.sourceforge.jtds.jdbc.SQLParser.parse(SQLParser.java:1254)  
at net.sourceforge.jtds.jdbc.SQLParser.parse(SQLParser.java:165)  
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.\<init\>(JtdsPreparedStatement.java:111)  
at net.sourceforge.jtds.jdbc.JtdsConnection.prepareStatement(JtdsConnection.java:2492)  
at net.sourceforge.jtds.jdbc.JtdsConnection.prepareStatement(JtdsConnection.java:2450)  
at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:387)  
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)  
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)  
... 64 more

2019-11-25 08:11:03,420 ERROR \[Long running task: Export Space\] \[confluence.importexport.actions.ExportSpaceLongRunningTask\] doInTransactionWithoutResult Error during export  
-- url: /spaces/doexportspace.action \| referer: <http://confluence-dev.cad.local/spaces/exportspacexml.action?key=BGCTD> \| traceId: ba292304c3ad9c73 \| userName: cb110602 \| action: doexportspace  
com.atlassian.confluence.importexport.ImportExportException: Couldn't backup database data.  
at com.atlassian.confluence.importexport.impl.AbstractXmlExporter.backupEntities(AbstractXmlExporter.java:212)  
at com.atlassian.confluence.importexport.impl.AbstractXmlExporter.backupEverything(AbstractXmlExporter.java:98)  
at com.atlassian.confluence.importexport.impl.FileXmlExporter.backupEverything(FileXmlExporter.java:95)  
at com.atlassian.confluence.importexport.impl.AbstractXmlExporter.doExport(AbstractXmlExporter.java:92)  
at com.atlassian.confluence.importexport.impl.FileXmlExporter.doExportInternal(FileXmlExporter.java:60)  
at com.atlassian.confluence.importexport.impl.FileXmlExporter.doExport(FileXmlExporter.java:54)  
at com.atlassian.confluence.importexport.impl.XmlExporter.doExport(XmlExporter.java:51)  
at com.atlassian.confluence.importexport.DefaultImportExportManager.doExport(DefaultImportExportManager.java:225)  
at com.atlassian.confluence.importexport.DefaultImportExportManager.exportAs(DefaultImportExportManager.java:191)  
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.$Proxy152.exportAs(Unknown Source)  
at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask$1.doInTransactionWithoutResult(ExportSpaceLongRunningTask.java:145)  
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)  
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)  
at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask.runInternal(ExportSpaceLongRunningTask.java:117)  
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.springframework.dao.DataIntegrityViolationException: could not prepare statement; SQL \[select TOP(?) user2conte0_.RELATIONID as col_0_0_ from USERCONTENT_RELATION user2conte0_ cross join CONTENT spaceconte1_ where spaceconte1_.CONTENTTYPE in ('PAGE', 'BLOGPOST', 'USERSTATUS', 'SPACEDESCRIPTION', 'MAIL', 'ATTACHMENT', 'CUSTOM') and user2conte0_.TARGETCONTENTID=spaceconte1_.CONTENTID and (case when spaceconte1_.PREVVER is not null then spaceconte1_.PREVVER else spaceconte1_.CONTENTID end in (select spaceconte2_.CONTENTID from CONTENT spaceconte2_ cross join SPACES space3_ where spaceconte2_.CONTENTTYPE in ('PAGE', 'BLOGPOST', 'USERSTATUS', 'SPACEDESCRIPTION', 'MAIL', 'ATTACHMENT', 'CUSTOM') and spaceconte2_.SPACEID=space3_.SPACEID and (spaceconte2_.CONTENTID not in (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?


Answers:
author: Shannon S
body: Sekhar,

Thank you for contacting us about this.

It seems like you've run into the following bug:

* [CONFSERVER-42654](https://jira.atlassian.com/browse/CONFSERVER-42654) *Custom Space Export Fails With "Prepared or callable statement has more than 2000 parameter markers"*

As a workaround, perform a full space export. You can then import the full space and remove the pages that aren't relevant.

Could I verify something with you, however? According to your build numbers and the bug itself, this might not be affecting recent versions of Confluence. Per our [End of Life](https://confluence.atlassian.com/support/atlassian-support-end-of-life-policy-201851003.html) policy, Confluence versions older than 6.6 are no longer supported. In addition, we had a pair of security vulnerabilities this past spring, and all Confluence instances should be on a supported version at this time. [Confluence CVEs and Common Questions](https://community.atlassian.com/t5/Confluence-articles/Confluence-CVEs-and-common-questions/ba-p/1062634) contains a list of versions which you need to be on *at minimum.*

* 6.6.13 or above in 6.6.x
* 6.12.4 or above in 6.12.x
* 6.13.4 or above in 6.13.x
* 6.14.3 or above in 6.14.x
* 6.15.2 or above

Can you confirm that you are indeed on a supported version of Confluence?

Regards,

Shannon

comments: author: Sekhar Chandra
body: Shannon,

Thanks for your support.

We are using Confluence 6.6.1 version.


author: Shannon S
body: Sekhar,

Thank you for confirming.

You can use the workaround I mentioned above:
> As a workaround, perform a full space export. You can then import the full space and remove the pages that aren't relevant.

In terms of your Confluence version, you need to [upgrade your site](https://confluence.atlassian.com/doc/upgrading-confluence-4578.html) to Confluence version 6.6.13 or higher to avoid having your site compromised.

Let me know if you have any trouble.

Regards,

Shannon


author: Sekhar Chandra
body: Thanks very much Shannon, the workaround worked for me.


author: Shannon S
body: Thank you for confirming, [@Sekhar Chandra](/t5/user/viewprofilepage/user-id/2916286)!

Please make sure to upgrade to 6.6.13 as soon as you can in order to avoid a site compromise. I'd hate to see you lose any data!

Regards,

Shannon


Tags: confluence-server

server