Failed to parse config file: Error on line -1 of document : Premature end of file.

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

Problem

After a Bamboo Server restart, the application doesn't start up and the following appears in <bamboo-home-directory>/logs/atlassian-bamboo.log:

2016-03-21 13:42:26,022 INFO [localhost-startStop-1] [lifecycle] Starting Bamboo 5.9.7 (build #5920 Wed Oct 14 07:27:00 BRT 2015) using Java 1.8.0_71 from Oracle Corporation
2016-03-21 13:42:26,022 INFO [localhost-startStop-1] [lifecycle] Real path of servlet context: /Users/bamboouser/Documents/Atlassian/bamboo/bamboo-5.9.7/install/atlassian-bamboo
2016-03-21 13:42:26,039 ERROR [localhost-startStop-1] [DefaultAtlassianBootstrapManager] Home is not configured properly: 
com.atlassian.config.ConfigurationException: Failed to parse config file: Error on line -1 of document  : Premature end of file. Nested exception: Premature end of file.
    at com.atlassian.config.xml.DefaultDom4jXmlConfigurationPersister.load(DefaultDom4jXmlConfigurationPersister.java:35)
    at com.atlassian.config.xml.DefaultDom4jXmlConfigurationPersister.load(DefaultDom4jXmlConfigurationPersister.java:65)
    at com.atlassian.config.ApplicationConfig.load(ApplicationConfig.java:365)
    at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.init(DefaultAtlassianBootstrapManager.java:68)
    at com.atlassian.bamboo.setup.BootstrapLoaderListener.contextInitialized(BootstrapLoaderListener.java:98)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.dom4j.DocumentException: Error on line -1 of document  : Premature end of file. Nested exception: Premature end of file.
    at org.dom4j.io.SAXReader.read(SAXReader.java:355)
    at org.dom4j.io.SAXReader.read(SAXReader.java:261)
    at com.atlassian.config.xml.AbstractDom4jXmlConfigurationPersister.loadDocument(AbstractDom4jXmlConfigurationPersister.java:68)
    at com.atlassian.config.xml.DefaultDom4jXmlConfigurationPersister.load(DefaultDom4jXmlConfigurationPersister.java:31)
    ... 13 more
2016-03-21 13:42:26,041 INFO [localhost-startStop-1] [lifecycle] Bamboo home directory: /Users/bamboouser/Documents/Atlassian/bamboo/bamboo-5.9.7/home
2016-03-21 13:42:26,042 INFO [localhost-startStop-1] [lifecycle] Default charset: UTF-8

Diagnosis

The <bamboo-home-directory>/bamboo.cfg.xml is empty. This file cannot be empty. It contains important information such as the database connection, license, path to important directories, etc.

Workaround

Force Bamboo to regenerate the bamboo.cfg.xml file. To do that we need to reinstall Bamboo and copy the file to our existing Bamboo Home directory. Please read all the steps carefully before going through the process.

  1. Create a new empty directory to use as the Bamboo Home directory. This temporary.
  2. Create a new empty database. This temporary.
  3. Edit the <bamboo-installation-directory>/atlassian-bamboo/WEB-INF/classes/bamboo-init.properties file.
  4. Point bamboo.home to the new directory created in Step 1.

    ## You can specify your bamboo.home property here or in your system environment variables.
    
    #bamboo.home=/old/path/to/home/directory
    bamboo.home=/new/path/to/temporary/home/directory
  5. Go to <bamboo-installation-directory>/bin and start Bamboo.

    If you access Bamboo through the web browser, you should be prompted to set up a new Bamboo instance. This is what we want.

  6. Go through the setup wizard process but point Bamboo to the new database (created in Step 2) and not to the existing one.
  7. After finishing the setup process, stop Bamboo.
  8. Go to the to the new Bamboo Home directory and copy the bamboo.cfg.xml file.
  9. Put the bamboo.cfg.xml file inside the old Bamboo Home directory.

    IMPORTANT: don't start Bamboo yet. Instead open up the bamboo.cfg.xml file.

  10. Edit the database connection properties to point to your existing Bamboo database.
  11. Go back to the <bamboo-installation-directory>/atlassian-bamboo/WEB-INF/classes/bamboo-init.properties file.
  12. Point bamboo.home back to the old directory

    ## You can specify your bamboo.home property here or in your system environment variables.
    
    bamboo.home=/old/path/to/home/directory
  13. Start Bamboo again.

 

Last modified on Mar 30, 2016

Was this helpful?

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