Cannot remove broken Bamboo plan - An invalid XML character

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

When trying to access the problematic plan or trying to remove it via the administration UI, Bamboo gives an error message:

com.google.common.util.concurrent.UncheckedExecutionException: 
com.google.common.util.concurrent.UncheckedExecutionException: 
com.atlassian.bamboo.exception.DataAccessException: 
org.apache.commons.configuration.ConfigurationException: Character 
reference "&#0" is an invalid XML character.
	at com.google.common.cache.CustomConcurrentHashMap$ComputedUncheckedException.get(CustomConcurrentHashMap.java:3305)
	at com.google.common.cache.CustomConcurrentHashMap$ComputingValueReference.compute(CustomConcurrentHashMap.java:3441)
	at com.google.common.cache.CustomConcurrentHashMap$Segment.compute(CustomConcurrentHashMap.java:2322)
	at com.google.common.cache.CustomConcurrentHashMap$Segment.getOrCompute(CustomConcurrentHashMap.java:2291)
	at com.google.common.cache.CustomConcurrentHashMap.getOrCompute(CustomConcurrentHashMap.java:3802)
	at com.google.common.cache.ComputingCache.get(ComputingCache.java:46)
	at com.google.common.cache.AbstractCache.getUnchecked(AbstractCache.java:49)
	at com.atlassian.bamboo.util.NullAwareCache.getUnchecked(NullAwareCache.java:37)
...
Caused by: 
com.google.common.util.concurrent.UncheckedExecutionException: 
com.atlassian.bamboo.exception.DataAccessException: 
org.apache.commons.configuration.ConfigurationException: Character 
reference "&#0" is an invalid XML character.
	at com.google.common.cache.CustomConcurrentHashMap$ComputedUncheckedException.get(CustomConcurrentHashMap.java:3305)
	at com.google.common.cache.CustomConcurrentHashMap$ComputingValueReference.compute(CustomConcurrentHashMap.java:3441)
	at com.google.common.cache.CustomConcurrentHashMap$Segment.compute(CustomConcurrentHashMap.java:2322)
	at com.google.common.cache.CustomConcurrentHashMap$Segment.getOrCompute(CustomConcurrentHashMap.java:2291)
	at com.google.common.cache.CustomConcurrentHashMap.getOrCompute(CustomConcurrentHashMap.java:3802)
	at com.google.common.cache.ComputingCache.get(ComputingCache.java:46)
...
Caused by: com.atlassian.bamboo.exception.DataAccessException: 
org.apache.commons.configuration.ConfigurationException: Character 
reference "&#0" is an invalid XML character.
	at com.atlassian.bamboo.utils.ConfigUtils.getXmlConfigFromXmlString(ConfigUtils.java:231)
	at com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration.<init>(BuildConfiguration.java:34)
	at com.atlassian.bamboo.build.DefaultBuildDefinitionManager.fillBuildDefinition(DefaultBuildDefinitionManager.java:95)
	at com.atlassian.bamboo.build.DefaultBuildDefinitionManager.getBuildDefinition(DefaultBuildDefinitionManager.java:80)
	at com.atlassian.bamboo.build.DefaultBuildDefinitionManager.getBuildDefinition(DefaultBuildDefinitionManager.java:73)
	at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source)
...
Caused by: org.apache.commons.configuration.ConfigurationException: Character reference "&#0" is an invalid XML character.
	at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:636)
	at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:609)
	at com.atlassian.bamboo.utils.ConfigUtils.getXmlConfigFromXmlString(ConfigUtils.java:226)
	... 200 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 25; columnNumber: 
94; Character reference "&#0" is an invalid XML character.
	at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
	at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:628)
	... 202 more

Cause

This can be a result of an automated process or a Copy/Paste of the plan content.

Resolution

  1. Stop your Bamboo server.
  2. Make sure that you have a backup of your Bamboo server before running any SQL query.
  3. Find the plan definition XML of the plan that Bamboo fails on from XML_DEFINITION_DATA column of build_definition table(replace the PLAN_KEY in the next SQL query with the full key of the problematic plan).

    select bd.build_definition_id, bd.xml_definition_data from build b, build_definition bd where b.build_id=bd.build_id and b.full_key like 'PLAN_KEY%'

    (use a % sign at the end of the PLAN_KEY to get a list of all related plans)

  4. By using an XML validator check the XML content that has been saved the XML_DEFINITION_DATA column of build_definition table from the results of the previous SQL query.
  5. There should be an invalid (invisible) character; please delete that character (on which the XML validator points to) and use the cleaned  XML to update the Bamboo database:

    update build_definition set XML_DEFINITION_DATA='<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <configuration>
      <inheritRepository>true</inheritRepository>
      <cleanWorkingDirectory>false</cleanWorkingDirectory>
      <repositoryDefiningWorkingDirectory>-1</repositoryDefiningWorkingDirectory>
      <buildTasks>
        <taskDefinition>
          <id>1</id>
    .... HERE GOES THE REST OF THE XML' WHERE BUILD_DEFINITION_ID = <the_build_definition_id_from_frevious_query>;

    The XML should be the same one that was causing the problem, but cleaned from invalid characters, and the BUILD_DEFINITION_ID is the ID from step 3.

  6. Start your Bamboo server, and it should work.

In addition, there is this improvement request (BAM-11037) created to make sure that every XML content is being validated before being saved in Bamboo database.

 

Last modified on Sep 12, 2013

Was this helpful?

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