java.io.FileNotFoundException when loading server.xml

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

Bitbucket Server fails to load the server.xml and the following appears in the catalina.out:

28-Jul-2016 19:00:00.000 SEVERE [main] com.atlassian.stash.internal.catalina.startup.Bootstrap.logError Copying fallback default-server.xml to shared home; no other server.xml file was found
28-Jul-2016 19:00:00.001 SEVERE [main] com.atlassian.stash.internal.catalina.startup.Bootstrap.logException Failed to copy /opt/atlassian/bitbucket/4.5.2/conf/.default-server.xml to /var/atlassian/application-data/bitbucket/shared/server.xml
 java.io.FileNotFoundException: /var/atlassian/application-data/bitbucket/shared/server.xml (Permission denied)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
	at com.atlassian.stash.internal.catalina.startup.Bootstrap$ArgumentDecorator.copyFallbackServerXmlTo(Bootstrap.java:196)
	at com.atlassian.stash.internal.catalina.startup.Bootstrap$ArgumentDecorator.apply(Bootstrap.java:131)
	at com.atlassian.stash.internal.catalina.startup.Bootstrap.main(Bootstrap.java:79)

Diagnosis

Diagnostic Steps

  • Check the permissions and ownership over the server.xml file by running:

    ls -l /var/atlassian/application-data/bitbucket/shared

Cause

  • The ownership over the server.xml file isn't not properly set. In the case above, it was set as follows:

    -rw------- 1 atlbitbucket  root    7662 Jul 28 12:00 server.xml

    The user is properly set as "atlbitbucket" as this is the user running the application, but it's related to the group "root".

Resolution

  • Adjust the ownership over the server.xml file according to the user running the application, then restart Bitbucket Server:

    chown atlbitbucket:atlbitbucket server.xml

Last modified on Apr 6, 2017

Was this helpful?

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