Could not load bootstrap from environment
Asked by Yonwon Park:

Level : fatal

Exception :

BootstrapException: Unable to bootstrap application: Failed to parse config file: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.


Answers:
author: Nic Brough -Adaptavist-
body: This error almost always means a configuration file is incorrectly formatted. Often server.xml, and it's almost always caused by a human editing the config files and mistyping something (although, if you're on a windows box, some editors do dumb things to text files that can corrupt them as well)

comments: author: Yonwon Park
body: Please double check my log below.


author: Nic Brough -Adaptavist-
body: You have not given us a log, and the error in your original question points to what I said already - an incorrectly formatted file.


author: Yonwon Park
body: Followings are meaningful logs I found...

2018-04-09 14:41:32,300 ERROR \[http-nio-8090-exec-7\] \[confluence.setup.johnson.WebAppContextPathCheck\] check Bootstrap did not initialize.  
2018-04-09 14:41:33,084 ERROR \[http-nio-8090-exec-8\] \[confluence.setup.johnson.WebAppContextPathCheck\] check Bootstrap did not initialize.  
2018-04-09 14:41:33,932 ERROR \[http-nio-8090-exec-9\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- referer: <http://vpark.ddns.net:28090/> \| url: /johnson/data \| traceId: 0018684d685eff4a  
2018-04-09 14:41:55,211 ERROR \[http-nio-8090-exec-10\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- referer: <http://vpark.ddns.net:28090/> \| url: /johnson/data \| traceId: 00e982a537650d68  
2018-04-09 14:42:11,026 ERROR \[http-nio-8090-exec-1\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- referer: <http://vpark.ddns.net:28090/> \| url: /johnson/data \| traceId: 00bea94c2984091f  
2018-04-09 14:42:27,023 ERROR \[http-nio-8090-exec-5\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- referer: <http://vpark.ddns.net:28090/> \| url: /johnson/data \| traceId: 00707f59fec8c414  
2018-04-09 14:42:43,011 ERROR \[http-nio-8090-exec-8\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- referer: <http://vpark.ddns.net:28090/> \| url: /johnson/data \| traceId: 00b4565c3e004981  
2018-04-09 14:42:59,168 ERROR \[http-nio-8090-exec-3\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- referer: <http://vpark.ddns.net:28090/> \| url: /johnson/data \| traceId: 00b3582eb761823d  
2018-04-09 14:43:15,010 ERROR \[http-nio-8090-exec-10\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- referer: <http://vpark.ddns.net:28090/> \| url: /johnson/data \| traceId: 000fef1bea8ea963  
2018-04-09 14:43:31,020 ERROR \[http-nio-8090-exec-1\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- referer: <http://vpark.ddns.net:28090/> \| url: /johnson/data \| traceId: 00e5000c3da91a29  
2018-04-09 14:43:43,524 ERROR \[localhost-startStop-4\] \[ContainerBase.\[Standalone\].\[localhost\].\[/\]\] log Session event listener threw exception  
java.lang.NullPointerException  
at com.atlassian.confluence.user.listeners.UserSessionExpiryListener.getEventPublisher(UserSessionExpiryListener.java:67)  
at com.atlassian.confluence.user.listeners.UserSessionExpiryListener.sessionDestroyed(UserSessionExpiryListener.java:46)  
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:837)  
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:779)  
at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:396)  
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)  
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5532)  
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)  
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424)  
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413)  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
at java.lang.Thread.run(Thread.java:748)  
2018-04-09 14:43:43,524 ERROR \[localhost-startStop-4\] \[ContainerBase.\[Standalone\].\[localhost\].\[/\]\] log Session event listener threw exception  
java.lang.NullPointerException  
at com.atlassian.confluence.user.listeners.UserSessionExpiryListener.getEventPublisher(UserSessionExpiryListener.java:67)  
at com.atlassian.confluence.user.listeners.UserSessionExpiryListener.sessionDestroyed(UserSessionExpiryListener.java:46)  
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:837)  
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:779)  
at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:396)  
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)  
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5532)  
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)  
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424)  
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413)  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
at java.lang.Thread.run(Thread.java:748)  
2018-04-09 14:43:43,524 FATAL \[localhost-startStop-4\] \[atlassian.spring.container.SpringContainerContext\] getComponent Spring Application context has not been set  
2018-04-09 14:43:43,539 WARN \[localhost-startStop-4\] \[atlassian.confluence.plugin.PluginFrameworkContextListener\] contextDestroyed Failed to shut down plugin system during ServletContext shutdown: Spring Application context has not been set  
2018-04-09 14:43:44,321 INFO \[localhost-startStop-4\] \[com.atlassian.confluence.lifecycle\] contextDestroyed Stopping Confluence

2018-04-09 14:44:04 Commons Daemon procrun stdout initialized  
2018-04-09 14:44:21,245 INFO \[localhost-startStop-1\] \[com.atlassian.confluence.lifecycle\] info Starting Confluence 6.7.1 \[build 7601 based on commit hash d9a7d86ddd6172b1b5a38b9e600c8b90c362def3\] - synchrony version 2.1.0-release-confluence_6.5-1a01ab2d  
2018-04-09 14:44:34,421 ERROR \[localhost-startStop-1\] \[atlassian.config.bootstrap.DefaultAtlassianBootstrapManager\] init Home is not configured properly:   
com.atlassian.config.ConfigurationException: Failed to parse config file: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.  
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:309)  
at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.init(DefaultAtlassianBootstrapManager.java:72)  
at com.atlassian.confluence.setup.DefaultBootstrapManager.init(DefaultBootstrapManager.java:179)  
at com.atlassian.config.util.BootstrapUtils.init(BootstrapUtils.java:36)  
at com.atlassian.confluence.setup.ConfluenceConfigurationListener.initialiseBootstrapContext(ConfluenceConfigurationListener.java:130)  
at com.atlassian.confluence.setup.ConfluenceConfigurationListener.contextInitialized(ConfluenceConfigurationListener.java:64)  
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4852)  
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5313)  
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)  
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)  
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
at java.lang.Thread.run(Thread.java:748)  
Caused by: org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.  
at org.dom4j.io.SAXReader.read(SAXReader.java:482)  
at org.dom4j.io.SAXReader.read(SAXReader.java:343)  
at com.atlassian.config.xml.AbstractDom4jXmlConfigurationPersister.loadDocument(AbstractDom4jXmlConfigurationPersister.java:69)  
at com.atlassian.config.xml.DefaultDom4jXmlConfigurationPersister.load(DefaultDom4jXmlConfigurationPersister.java:31)  
... 16 more  
2018-04-09 14:44:34,468 ERROR \[localhost-startStop-1\] \[atlassian.confluence.setup.ConfluenceConfigurationListener\] error An error was encountered while bootstrapping Confluence (see below):   
Unable to bootstrap application: Failed to parse config file: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.  
com.atlassian.config.bootstrap.BootstrapException: Unable to bootstrap application: Failed to parse config file: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.  
at com.atlassian.config.util.BootstrapUtils.init(BootstrapUtils.java:39)  
at com.atlassian.confluence.setup.ConfluenceConfigurationListener.initialiseBootstrapContext(ConfluenceConfigurationListener.java:130)  
at com.atlassian.confluence.setup.ConfluenceConfigurationListener.contextInitialized(ConfluenceConfigurationListener.java:64)  
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4852)  
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5313)  
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)  
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)  
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
at java.lang.Thread.run(Thread.java:748)  
2018-04-09 14:44:36,921 INFO \[localhost-startStop-1\] \[com.atlassian.confluence.lifecycle\] init Confluence is ready to serve  
2018-04-09 14:44:46,124 ERROR \[http-nio-8090-exec-1\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- referer: <http://vpark.ddns.net:28090/> \| url: /johnson/data \| traceId: 009651eefc20a551


author: Nic Brough -Adaptavist-
body: Same answer. You've amended a config file and made a mess of it.

At a guess, I'd say it's the application properties file where you define confluence.home


author: Suren Raj
body: Hi, [@Yonwon Park](/t5/user/viewprofilepage/user-id/1207851)

The ERROR indicate it seems to be unable to start up classes correctly. Therefore, for the next steps we would like to refresh the classes first as part of initial step to recover the instance

1. shutdown Confluence
2. backup both Confluence Installation, Home directory and the Shared Directories
3. delete the **contents** of the following directories:

   ```
   <confluence-home>/bundled-plugins<confluence-home>/plugins-cache<confluence-home>/plugins-osgi-cache<confluence-home>/plugins-temp<confluence-home>/bundled-plugins_language<confluence-home/webresource-temp<confluence-install/work<confluence-install/temp
   ```

4. startup Confluence

Let us know how it goes.

comments: author: Allan Margono
body: Hello,

I have the same issue. Delete the contents of the following folders, didn't help.

```
<confluence-home>/bundled-plugins<confluence-home>/plugins-cache<confluence-home>/plugins-osgi-cache<confluence-home>/plugins-temp<confluence-home>/bundled-plugins_language<confluence-home/webresource-temp<confluence-install/work<confluence-install/temp
```

2018-04-23 15:44:34,407 ERROR \[http-nio-8080-exec-125\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- url: /status \| traceId: 00c09ddca3fb67b2  
2018-04-23 15:44:34,410 ERROR \[http-nio-8080-exec-126\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- url: /status \| traceId: 009a559f172d9a05  
2018-04-23 15:44:34,416 ERROR \[http-nio-8080-exec-127\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- url: /status \| traceId: 007502b065fe18e7  
2018-04-23 15:44:34,419 ERROR \[http-nio-8080-exec-128\] \[atlassian.confluence.util.AbstractBootstrapHotSwappingFilter\] doFilter Could not get swap target filter  
-- url: /status \| traceId: 00368520685ab590

Any idea on how to resolve this?

This happened when I migrated the database from a single server to a data center server.

Confluence version: 6.6.1


author: Trevor Wood
body: I had a similar issue this morning after our system admins did routine server patching. Not sure what exactly cause confluence not to come back, but this worked for me. I did have to edit some permissions to allow writes in confluence-home after the next confluence start.


author: Felix Haimmerer
body: I had the same error. The issue in my case was that not all nodes in the cluster were on the same Confluence Version.

Hope this helps someone. :)


author: Zam
body: I had similar issue. None of mentioned here solution works for me.

BootstrapException: Unable to bootstrap application: Failed to parse config file: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.

comments: author: Nic Brough -Adaptavist-
body: The solution is to correct the errors in the configuration file you have edited.

(Or correct the permissions on it, as this error can be thrown when the file cannot be opened by the user running the application)


author: Mike Silverglate
body: If someone else comes across this, in my case it was file permissions in /var/atlassian/...


author: AnnWorley
body: [@Allan Margono](/t5/user/viewprofilepage/user-id/40170) I am not sure what "Could not get swap target filter" means as I could not find it documented anywhere. However, [@Yonwon Park](/t5/user/viewprofilepage/user-id/1207851) posted another error that indicated an issue with the confluence-init.properties file, where the confluence.home path is defined:

```
2018-04-09 14:44:34,421 ERROR [localhost-startStop-1] [atlassian.config.bootstrap.DefaultAtlassianBootstrapManager] init Home is not configured properly
```

So, if you changed the [confluence home](https://confluence.atlassian.com/conf66/confluence-home-and-other-important-directories-943962620.html) during the database migration, please check the following file: \<confluence_install\>/confluence/WEB-INF/classes/confluence-init.properties. If you had to change the database connection URL in the confluence.cfg.xml or server.xml then please check those configuration files for unusual or unexpected characters, and typos.


author: Sloan
body: Hi [@Yonwon Park](/t5/user/viewprofilepage/user-id/1207851)

Can you give us more Informations? Is this about a fresh installed Confluence or did you made any changes to a already installed Confluence previously?

This log entry hints to this problem: [Confluence will not start up due to no server id found](https://confluence.atlassian.com/confkb/confluence-will-not-start-up-due-to-no-server-id-found-420973367.html)

Please check the troubleshooting steps on this page.

Cheers  
Niklas