Bamboo cannot start - An invalid XML character

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Bamboo fails to start and gives an error message that: An invalid XML character (Unicode: 0x13) was found in the element content of the document.

2012-02-28 09:56:20,537 INFO [main] [BambooContainer] Checking build HST-Core - Nightly Development Build - Run
[Fatal Error] :35:226: An invalid XML character (Unicode: 0x13) was found in the element content of the document.
2012-02-28 09:56:20,549 ERROR [main] [ConfigUtils] Error getting Build Configuration from '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration>
  <inheritRepository>true</inheritRepository>
  <cleanWorkingDirectory>false</cleanWorkingDirectory>
  <repositoryDefiningWorkingDirectory>-1</repositoryDefiningWorkingDirectory>
  <buildTasks>
    <taskDefinition>
      <id>1</id>
      <userDescription>Checkout Default Repository</userDescription>
      <pluginKey>com.atlassian.bamboo.plugins.vcs:task.vcs.checkout</pluginKey>
      <finalising>false</finalising>
      <rootDirectoryType>INHERITED</rootDirectoryType>
      <repositoryDefiningWorkingDir>-1</repositoryDefiningWorkingDir>
      <config>
        <item>
          <key>selectedRepository_0</key>
          <value>defaultRepository</value>
        </item>
        <item>
          <key>checkoutDir_0</key>
          <value/>
        </item>
      </config>
    </taskDefinition>
    <taskDefinition>
      <id>2</id>
      <userDescription/>
      <pluginKey>com.atlassian.bamboo.plugins.scripttask:task.builder.command</pluginKey>
      <finalising>false</finalising>
      <rootDirectoryType>INHERITED</rootDirectoryType>
      <repositoryDefiningWorkingDir>-1</repositoryDefiningWorkingDir>
      <config>
        <item>
          <key>argument</key>
          <value>bin/build_automation hst_core.HstCore --build-type=trunk --bamboo-buildKey=${bamboo.buildKey} --bamboo-buildNumber=${bamboo.buildNumber}  --sandbox=/var/tmp  --package-directory=/hst/groups/hst_core/packages d --release-directory=/hst/dev/applications</value>
        </item>
        <item>
          <key>label</key>
          <value>Python 2.5</value>
        </item>
        <item>
          <key>workingSubDirectory</key>
          <value/>
        </item>
        <item>
          <key>environmentVariables</key>
          <value/>
        </item>
      </config>
    </taskDefinition>
  </buildTasks>
  <selectedBuildStrategy>manualOnly</selectedBuildStrategy>
</configuration>
'.
org.apache.commons.configuration.ConfigurationException: An invalid XML character (Unicode: 0x13) was found in the element content of the document.
	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:222)
	at com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration.<init>(BuildConfiguration.java:39)
	at com.atlassian.bamboo.build.DefaultBuildDefinitionManager.getBuildDefinition(DefaultBuildDefinitionManager.java:71)
	at sun.reflect.GeneratedMethodAccessor187.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
	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 $Proxy48.getBuildDefinition(Unknown Source)
	at com.atlassian.bamboo.build.CachedBuildDefinitionManagerImpl$1.apply(CachedBuildDefinitionManagerImpl.java:44)
	at com.atlassian.bamboo.build.CachedBuildDefinitionManagerImpl$1.apply(CachedBuildDefinitionManagerImpl.java:38)
	at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:155)
	at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:116)
	at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:67)
	at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:623)
	at com.atlassian.bamboo.build.CachedBuildDefinitionManagerImpl.getBuildDefinition(CachedBuildDefinitionManagerImpl.java:59)
	at com.atlassian.bamboo.plan.AbstractPlan.getBuildDefinition(AbstractPlan.java:277)
	at com.atlassian.bamboo.container.BambooContainer.reportTaskAndRepositoryProblems(BambooContainer.java:416)
	at com.atlassian.bamboo.container.BambooContainer.reportBuildConfigurationProblems(BambooContainer.java:385)
	at com.atlassian.bamboo.container.BambooContainer.start(BambooContainer.java:248)
	at com.atlassian.bamboo.upgrade.UpgradeLauncher.upgradeAndStartBamboo(UpgradeLauncher.java:150)
	at com.atlassian.bamboo.upgrade.UpgradeLauncher.contextInitialized(UpgradeLauncher.java:39)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:633)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:228)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1160)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:576)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
	at org.eclipse.jetty.server.Server.doStart(Server.java:243)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
	at com.atlassian.bamboo.server.Server.main(Server.java:75)
Caused by: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x13) was found in the element content of the document.
	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)
	... 37 more
2012-02-28 09:56:20,555 FATAL [main] [BambooContainer] Cannot start bamboo

Cause

This can be a result of an automated process or a Copy/Paste of the 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 exact row ID that Bamboo fails on from XML_DEFINITION_DATA column of build_definition table.
  4. By using an XML validator check the XML content that has been saved in Bamboo (XML_DEFINITION_DATA column of build_definition table) that causes the problem.
  5. There should be an invalid (invisible) character; please delete that character and use theme  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>
          <userDescription>Checkout Default Repository</userDescription>
          <pluginKey>com.atlassian.bamboo.plugins.vcs:task.vcs.checkout</pluginKey>
          <finalising>false</finalising>
          <rootDirectoryType>INHERITED</rootDirectoryType>
          <repositoryDefiningWorkingDir>-1</repositoryDefiningWorkingDir>
          <config>
            <item>
              <key>selectedRepository_0</key>
              <value>defaultRepository</value>
            </item>
            <item>
              <key>checkoutDir_0</key>
              <value/>
            </item>
          </config>
        </taskDefinition>
        <taskDefinition>
          <id>2</id>
          <userDescription/>
          <pluginKey>com.atlassian.bamboo.plugins.scripttask:task.builder.command</pluginKey>
          <finalising>false</finalising>
          <rootDirectoryType>INHERITED</rootDirectoryType>
          <repositoryDefiningWorkingDir>-1</repositoryDefiningWorkingDir>
          <config>
            <item>
              <key>argument</key>
              <value>bin/build_automation hst_core.HstCore --build-type=trunk --bamboo-buildKey=${bamboo.buildKey} --bamboo-buildNumber=${bamboo.buildNumber}  --sandbox=/var/tmp  --package-directory=/hst/groups/hst_core/packages d --release-directory=/hst/dev/applications</value>
            </item>
            <item>
              <key>label</key>
              <value>Python 2.5</value>
            </item>
            <item>
              <key>workingSubDirectory</key>
              <value/>
            </item>
            <item>
              <key>environmentVariables</key>
              <value/>
            </item>
          </config>
        </taskDefinition>
      </buildTasks>
      <selectedBuildStrategy>manualOnly</selectedBuildStrategy>
    </configuration>' where build_definition_id=50921482;

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

  6. Start your Bamboo server, and ti 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 Nov 21, 2012

Was this helpful?

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