java.io.FileNotFoundException when loading server.xml

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Summary

Problem

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

1 2 3 4 5 6 7 8 9 10 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:

    1 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:

    1 -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".

Solution

Resolution

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

    1 chown atlbitbucket:atlbitbucket server.xml

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.