Upgrading Confluence to 5.3 fails with "Incorrect result size: expected 1, actual 0"

Still need help?

The Atlassian Community is here for you.

Ask the community

 

Symptoms

Upgrading Confluence to 5.3 fails with "Incorrect result size: expected 1, actual 0".

The following appears in the atlassian-confluence.log:

2013-10-03 18:17:30,826 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.UserMappingLowerUsernameSchemaUpgradeTask@148c5775 failed during the UPGRADE phase due to: Incorrect result size: expected 1, actual 0
com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.UserMappingLowerUsernameSchemaUpgradeTask@148c5775 failed during the UPGRADE phase due to: Incorrect result size: expected 1, actual 0
	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:278)
	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.runUpgradeTasks(AbstractUpgradeManager.java:214)
	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:159)
	at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:50)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.dao.EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0
	at org.springframework.dao.support.DataAccessUtils.requiredSingleResult(DataAccessUtils.java:71)
	at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:475)
	at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:479)
	at com.atlassian.confluence.upgrade.upgradetask.UserMappingLowerUsernameSchemaUpgradeTask.doUpgrade(UserMappingLowerUsernameSchemaUpgradeTask.java:59)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at com.sun.proxy.$Proxy23.doUpgrade(Unknown Source)
	at com.atlassian.confluence.upgrade.AbstractUpgradeManager$UpgradeStep$4.execute(AbstractUpgradeManager.java:695)
	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:254)
	... 18 more
2013-10-03 18:17:30,833 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1 errors were encountered during upgrade:
2013-10-03 18:17:30,834 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1: Incorrect result size: expected 1, actual 0

Diagnosis

Check if all database objects are using the default collation SQL_Latin1_General_CP1_CS_AS, as described in our MS SQL server setup guide. In case the queries bellow return anything different than the SQL_Latin1_General_CP1_CS_AS collation, follow the instructions of the Resolution section.

Run this query to see the default database collation:

SELECT object_name(object_id) as TableName, name as ColumnName, collation_name
FROM sys.columns
WHERE collation_name <> 'SQL_Latin1_General_CP1_CS_AS'
AND object_name(object_id) NOT LIKE 'sys%' 
AND object_name(object_id) NOT LIKE 'queue%'
AND object_name(object_id) NOT LIKE 'file%'

 

Cause

This issue is caused by a incorrect collation of some table columns.

Resolution

 

  1. Set up a test instance with your production data by following this guide.
  2. Once your Confluence is working in your testing instance, take an XML Backup.
  3. Go to Manage Add-ons > User Installed and make note of your installed plugins.
  4. Create a new database in MS SQL Server following the instructions in here to ensure that the collation is set correctly.

    Please make sure that your database version is listed in our Supported Platforms page.

  5. Install a new, empty version of Confluence (the version *must* be the same version of your test instance), and point it to the empty database you created in step 4.
  6. During the install process, select the option to restore from backup, and restore the XML backup into the new db.
  7. Install your plugins into the new instance.
  8. Then try to upgrade your Confluence again.

Alternate Resolution:
Follow the directions in the following technet articles to manually change the collation in affected columns. 

http://technet.microsoft.com/en-us/library/ms175835.aspx

http://technet.microsoft.com/en-us/library/ms190920.aspx

Last modified on Nov 2, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.