Bamboo export and scheduled backups fail with NullPointerException

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Attempting to create an export from Bamboo (Bamboo administration > Overview > System > Export) or scheduled backups (Bamboo administration > Overview > System > Scheduled backups) fail with the following error message inside the <Bamboo server home directory>/logs/atlassian-bamboo.log files:

2021-08-24 12:26:29,468 ERROR [scheduler_Worker-9] [ScheduledBackupJob] java.lang.NullPointerException
java.lang.NullPointerException
        at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:453)
        at org.codehaus.staxmate.out.SMOutputContext.writeCharacters(SMOutputContext.java:479)
        at org.codehaus.staxmate.out.SMOutputContainer.addCharacters(SMOutputContainer.java:171)
        at com.atlassian.bamboo.migration.SMOutputElementAppender.append(SMOutputElementAppender.java:37)
        at com.atlassian.bamboo.migration.stream.AbstractPlanMapper.exportProperties(AbstractPlanMapper.java:108)
        at com.atlassian.bamboo.migration.stream.build.AbstractChainMapper.exportProperties(AbstractChainMapper.java:77)
        at com.atlassian.bamboo.migration.stream.build.ChainBranchMapper.exportProperties(ChainBranchMapper.java:85)
        at com.atlassian.bamboo.migration.stream.build.ChainBranchMapper.exportProperties(ChainBranchMapper.java:32)
        at com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl.exportXml(BambooStAXMappingHelperAbstractImpl.java:103)
        at com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl.exportListXml(BambooStAXMappingListHelperAbstractImpl.java:162)
        at com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl.exportListXml(BambooStAXMappingListHelperAbstractImpl.java:143)
        at com.atlassian.bamboo.migration.stream.build.ProjectMapper.exportProperties(ProjectMapper.java:110)
        at com.atlassian.bamboo.migration.stream.build.ProjectMapper.exportProperties(ProjectMapper.java:36)
        at com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl.exportXml(BambooStAXMappingHelperAbstractImpl.java:103)
        at com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl.exportListXml(BambooStAXMappingListHelperAbstractImpl.java:162)
        at com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl.exportListXml(BambooStAXMappingListHelperAbstractImpl.java:143)
        at com.atlassian.bamboo.migration.stream.AbstractProjectMapper.exportData(AbstractProjectMapper.java:145)
        at com.atlassian.bamboo.migration.XmlMigrator.exportToStream(XmlMigrator.java:523)
        at com.atlassian.bamboo.migration.XmlMigrator.exportXml(XmlMigrator.java:470)
        at com.atlassian.bamboo.migration.XmlMigrator$$FastClassBySpringCGLIB$$b6578fc7.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
        at com.atlassian.bamboo.migration.XmlMigrator$$EnhancerBySpringCGLIB$$60f23768.exportXml(<generated>)
        at com.atlassian.bamboo.migration.ImportExportManagerImpl.bambooExport(ImportExportManagerImpl.java:91)
        at com.atlassian.bamboo.configuration.ScheduledBackupJob.execute(ScheduledBackupJob.java:71)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
        at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
        at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
        at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)

Diagnosis

Use the following select query inside the Bamboo database to look for an entries inside the BUILD table that don't contain a title:

select * from build where title is null;

Cause

Plans, plan branches and jobs must all have a title in Bamboo. They cannot be null. This is a required field in the Bamboo UI. If you have any entries inside the BUILD table that don't contain a title they're likely to cause problems during the export/ backup process. We don't know what exactly causes/ triggers the title of a plan, plan branch of job to be null but we have identified this to be the source of the problem described in this kb article.

Solution

Solution 1

After running the select query above and identifying the list of items with null titles you can then access them from the Bamboo UI and update the field so they're not null anymore. Results from the BUILD table can be of the following nature/ type:

  • CHAIN (main plan)
    1. To update the title of a plan (Plan name) you need to access the following page: <bambooBaseURL>/chain/admin/config/editChainDetails.action?buildKey=<planKey>
  • CHAIN_BRANCH (plan branch)
    1. To update the title of a plan branch (Display name) you need to access the following page: <bambooBaseURL>/branch/admin/config/editChainBranchDetails.action?planKey=<planBranchKey>
  • JOB (job)
    1. To update the title of a job (Job name) you need to access the following page: <bambooBaseURL>/build/admin/edit/editBuildDetails.action?buildKey=<jobKey>

You must replace <bambooBaseURL> with your Bamboo's Base URL (e.g. http://mybamboo:8085, https://bamboo.mycompany.com and etc) and the key of the item you're trying to update. The key of the item is the FULL_KEY column from the results you'll obtain after running the select query mentioned above.

Once you have updated the titles of the items that returned null before check again by running the select query one more time. If the result are now empty you're good to try another export/ scheduled backup.

Solution 2

It is also possible to delete the plan, plan branch or job causing problems. For example, if you run the select query above and get two plan branches with null titles that are no longer needed you can delete them to prevent the export/ schedule backup failure. In order to delete any of them you can:

  • CHAIN (main plan)
    1. To delete a plan you need to access the following page: <bambooBaseURL>/chain/admin/config/editChainDetails.action?buildKey=<planKey>
    2. Click the Actions > Delete plan button.
  • CHAIN_BRANCH (plan branch)
    1. To delete a plan branch you need to access the following page: <bambooBaseURL>/branch/admin/config/editChainBranchDetails.action?planKey=<planBranchKey>
    2. Click the Actions > Delete plan branch button.
  • JOB (job)
    1. To delete a job you need to access the following page: <bambooBaseURL>/build/admin/edit/editBuildDetails.action?buildKey=<jobKey>
    2. Click the Actions > Delete job button.

Plans, plan branches and jobs will not be immediately removed from Bamboo after you click the Delete button. They will be flagged for removal and deleted by a background process running every 3 minutes – so you must wait at least 3 minutes after removing the last item from the UI before attempting to create a new export. Our recommendation would be to remove all of them, wait a few minutes and run the select query again to make sure there are no more items without a title.

If the results are empty you should be good to try a new export.

Solution 3

If you get too many results from the select query above and wish to update the null titles in bulk you can do it from the database. This is not our recommended approach for dealing with this type of problem so please be careful.

Take a backup from your Bamboo database before making any changes!

  1. Stop Bamboo.
  2. You can use the following update query to change the title of the items you identified previously:

    update build set title = 'atl-fix-backup' where build_id in (<buildID_1>,<buildID_2>,<buildID_3>,...);

    Choose a title for the items you're going to update (preferably something you can use later to identify the records that got updated e.g. atl-fix-backup) and replace the <buildID_1>, <buildID_2> and so on with the ids from the BUILD_ID column for the results of the select query above.

  3. Check and make sure there are no more items with null titles:

    select * from build where title is null;
  4. Start Bamboo.
Last modified on Oct 14, 2021

Was this helpful?

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