Upgrade self-hosted atlassian bitbucket 4.x to 5.x in CentOS 7

Author:

Here we are going to show you a real example of how we upgraded out Atlassian Bitbucket server from 4.14.4 (around April 2017 installation) with the latest version of Atlassian Bitbucket 5.14.0. We use

  1. using self-hosted instance of Bitbucket 4.14.4
  2. Linux distro – CentOS 7.
  3. MySQL server for back-end. So there is a jdbc mysql driver (which should be installed after the upgrade).
  4. NGINX is used as proxy for our main HTTPS url. So we have changed our default configuration in server (in sever.xml).
  5. Bitbucket is loaded from a URL/bitbucket – “https://dev.example.com/bitbucket/”. So we have changed our default configuration (in sever.xml).

and you’ll see there are some pitfalls you can avoid if you follow our article. The latest git program in CentOS 7 is 1.8 and is not compatible with the new Atlassian Bitbucket 5.x, so we need to solve this problem before updating the server. Check out the official upgrade page here

STEP 1) Make a full backup of your server.

We have installed our bitbucket server in a LXC container, so it is easy to stop, backup the whole directory root / directory and start the container again. No matter you use a dedicated server or a virtual one you MUST make a full backup before starting the upgrade.
In our case we did:

rsync -AXx --delete --verbose --progress --stats --recursive --times --perms --links --owner --group --hard-links --devices /mnt/sotrage/lxc/bitbucket/rootfs /mnt/sotrage/lxc/bitbucket/rootfs-backup/

STEP 2) Download the latest Atlassian Bitbucket and upload the binary file in your server.

Start the binary with:

[root@dev ~]# chmod o+x atlassian-bitbucket-5.14.0-x64.bin 
[root@dev ~]# ./atlassian-bitbucket-5.14.0-x64.bin 
Unpacking JRE ...
Starting Installer ...

Unsupported Git version found [1.8.3.1]. Please upgrade Git to a supported
version before installing Bitbucket.
See http://go.atlassian.com/installgit for more information.
NOTE: If you proceed without a working Git, Bitbucket won't be able to start
after installation until a working Git is found.
If you proceed without a working Git, Bitbucket won't be able to start after installation. 
Are you sure you want to continue?
Yes [y, Enter], No [n]
n
Finishing installation ...

As you can see our git version is 1.8.3.1 and this is the latest one in CentOS 7 so no update for this.

STEP 3) Update git to 2.x version under CentOS 7

The lastest version in CentOS 7 is 1.8.3.1, but we need at least 2.x so probably we could compile git ourselves, but we could break our compilation in the future if we update our system, so the best way is to use a repository with a newer version of git! Most third party CentOS 7 repositories have newer version of git, but we prefer to use CentOS 7 managed repository when possible like Software Collections (SCL).

The SCL repository is now maintained by a CentOS SIG and thus is not strictly a CentOS repo.

SCL is known to be very stable and not breaking your current installation and you can live with the two versions installed from the official CentOS 7 and the SCL repositories.

[root@dev ~]# yum install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.atlanticmetro.net
 * epel: mirror.us.leaseweb.net
 * extras: mirror.atlanticmetro.net
 * updates: mirrors.advancedhosters.com
Package epel-release-7-11.noarch already installed and latest version
Nothing to do
[root@dev ~]# yum install centos-release-scl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.atlanticmetro.net
 * epel: mirror.us.leaseweb.net
 * extras: mirror.atlanticmetro.net
 * updates: mirrors.advancedhosters.com
Resolving Dependencies
--> Running transaction check
---> Package centos-release-scl.noarch 0:2-2.el7.centos will be installed
--> Processing Dependency: centos-release-scl-rh for package: centos-release-scl-2-2.el7.centos.noarch
--> Running transaction check
---> Package centos-release-scl-rh.noarch 0:2-2.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================
 Package                                           Arch                               Version                                      Repository                          Size
============================================================================================================================================================================
Installing:
 centos-release-scl                                noarch                             2-2.el7.centos                               extras                              12 k
Installing for dependencies:
 centos-release-scl-rh                             noarch                             2-2.el7.centos                               extras                              12 k

Transaction Summary
============================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 24 k
Installed size: 39 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): centos-release-scl-2-2.el7.centos.noarch.rpm                                                                                                  |  12 kB  00:00:00     
(2/2): centos-release-scl-rh-2-2.el7.centos.noarch.rpm                                                                                               |  12 kB  00:00:00     
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                        87 kB/s |  24 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : centos-release-scl-rh-2-2.el7.centos.noarch                                                                                                              1/2 
  Installing : centos-release-scl-2-2.el7.centos.noarch                                                                                                                 2/2 
  Verifying  : centos-release-scl-rh-2-2.el7.centos.noarch                                                                                                              1/2 
  Verifying  : centos-release-scl-2-2.el7.centos.noarch                                                                                                                 2/2 

Installed:
  centos-release-scl.noarch 0:2-2.el7.centos                                                                                                                                

Dependency Installed:
  centos-release-scl-rh.noarch 0:2-2.el7.centos                                                                                                                             

Complete!
[root@dev ~]# yum install rh-git29
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.atlanticmetro.net
 * epel: mirror.us.leaseweb.net
 * extras: mirror.atlanticmetro.net
 * updates: mirrors.advancedhosters.com
centos-sclo-rh                                                                                                                                       | 3.0 kB  00:00:00     
centos-sclo-sclo                                                                                                                                     | 2.9 kB  00:00:00     
(1/2): centos-sclo-rh/x86_64/primary_db                                                                                                              | 3.7 MB  00:00:00     
(2/2): centos-sclo-sclo/x86_64/primary_db                                                                                                            | 292 kB  00:00:01     
Resolving Dependencies
--> Running transaction check
---> Package rh-git29.x86_64 0:2.3-4.el7 will be installed
--> Processing Dependency: scl-utils for package: rh-git29-2.3-4.el7.x86_64
--> Processing Dependency: rh-git29-runtime for package: rh-git29-2.3-4.el7.x86_64
--> Processing Dependency: rh-git29-git for package: rh-git29-2.3-4.el7.x86_64
--> Running transaction check
---> Package rh-git29-git.x86_64 0:2.9.3-4.el7 will be installed
--> Processing Dependency: rh-git29-perl-Git = 2.9.3-4.el7 for package: rh-git29-git-2.9.3-4.el7.x86_64
--> Processing Dependency: rh-git29-git-core-doc = 2.9.3-4.el7 for package: rh-git29-git-2.9.3-4.el7.x86_64
--> Processing Dependency: rh-git29-git-core = 2.9.3-4.el7 for package: rh-git29-git-2.9.3-4.el7.x86_64
--> Processing Dependency: emacs-filesystem >= 24.3 for package: rh-git29-git-2.9.3-4.el7.x86_64
--> Processing Dependency: rh-git29-perl(Git) for package: rh-git29-git-2.9.3-4.el7.x86_64
---> Package rh-git29-runtime.x86_64 0:2.3-4.el7 will be installed
---> Package scl-utils.x86_64 0:20130529-18.el7_4 will be installed
--> Running transaction check
---> Package emacs-filesystem.noarch 1:24.3-20.el7_4 will be installed
---> Package rh-git29-git-core.x86_64 0:2.9.3-4.el7 will be installed
--> Processing Dependency: httpd24-libcurl for package: rh-git29-git-core-2.9.3-4.el7.x86_64
--> Processing Dependency: libcurl-httpd24.so.4()(64bit) for package: rh-git29-git-core-2.9.3-4.el7.x86_64
---> Package rh-git29-git-core-doc.x86_64 0:2.9.3-4.el7 will be installed
---> Package rh-git29-perl-Git.noarch 0:2.9.3-4.el7 will be installed
--> Running transaction check
---> Package httpd24-libcurl.x86_64 0:7.47.1-4.el7 will be installed
--> Processing Dependency: httpd24-runtime for package: httpd24-libcurl-7.47.1-4.el7.x86_64
--> Processing Dependency: libnghttp2-httpd24.so.14()(64bit) for package: httpd24-libcurl-7.47.1-4.el7.x86_64
--> Running transaction check
---> Package httpd24-libnghttp2.x86_64 0:1.7.1-6.el7 will be installed
---> Package httpd24-runtime.x86_64 0:1.1-18.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================
 Package                                        Arch                            Version                                       Repository                               Size
============================================================================================================================================================================
Installing:
 rh-git29                                       x86_64                          2.3-4.el7                                     centos-sclo-rh                          2.9 k
Installing for dependencies:
 emacs-filesystem                               noarch                          1:24.3-20.el7_4                               base                                     58 k
 httpd24-libcurl                                x86_64                          7.47.1-4.el7                                  centos-sclo-rh                          260 k
 httpd24-libnghttp2                             x86_64                          1.7.1-6.el7                                   centos-sclo-rh                           61 k
 httpd24-runtime                                x86_64                          1.1-18.el7                                    centos-sclo-rh                           28 k
 rh-git29-git                                   x86_64                          2.9.3-4.el7                                   centos-sclo-rh                          985 k
 rh-git29-git-core                              x86_64                          2.9.3-4.el7                                   centos-sclo-rh                          3.5 M
 rh-git29-git-core-doc                          x86_64                          2.9.3-4.el7                                   centos-sclo-rh                          2.2 M
 rh-git29-perl-Git                              noarch                          2.9.3-4.el7                                   centos-sclo-rh                           35 k
 rh-git29-runtime                               x86_64                          2.3-4.el7                                     centos-sclo-rh                           25 k
 scl-utils                                      x86_64                          20130529-18.el7_4                             base                                     24 k

Transaction Summary
============================================================================================================================================================================
Install  1 Package (+10 Dependent packages)

Total download size: 7.1 M
Installed size: 33 M
Is this ok [y/d/N]: y
Downloading packages:
(1/11): emacs-filesystem-24.3-20.el7_4.noarch.rpm                                                                                                    |  58 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/centos-sclo-rh/packages/httpd24-libnghttp2-1.7.1-6.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f2ee9d55: NOKEY
Public key for httpd24-libnghttp2-1.7.1-6.el7.x86_64.rpm is not installed
(2/11): httpd24-libnghttp2-1.7.1-6.el7.x86_64.rpm                                                                                                    |  61 kB  00:00:00     
(3/11): httpd24-runtime-1.1-18.el7.x86_64.rpm                                                                                                        |  28 kB  00:00:00     
(4/11): httpd24-libcurl-7.47.1-4.el7.x86_64.rpm                                                                                                      | 260 kB  00:00:00     
(5/11): rh-git29-2.3-4.el7.x86_64.rpm                                                                                                                | 2.9 kB  00:00:00     
(6/11): rh-git29-git-core-2.9.3-4.el7.x86_64.rpm                                                                                                     | 3.5 MB  00:00:00     
(7/11): rh-git29-git-2.9.3-4.el7.x86_64.rpm                                                                                                          | 985 kB  00:00:00     
(8/11): rh-git29-perl-Git-2.9.3-4.el7.noarch.rpm                                                                                                     |  35 kB  00:00:00     
(9/11): scl-utils-20130529-18.el7_4.x86_64.rpm                                                                                                       |  24 kB  00:00:00     
(10/11): rh-git29-runtime-2.3-4.el7.x86_64.rpm                                                                                                       |  25 kB  00:00:00     
(11/11): rh-git29-git-core-doc-2.9.3-4.el7.x86_64.rpm                                                                                                | 2.2 MB  00:00:00     
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                       3.7 MB/s | 7.1 MB  00:00:01     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
Importing GPG key 0xF2EE9D55:
 Userid     : "CentOS SoftwareCollections SIG (https://wiki.centos.org/SpecialInterestGroup/SCLo) <security@centos.org>"
 Fingerprint: c4db d535 b1fb ba14 f8ba 64a8 4eb8 4e71 f2ee 9d55
 Package    : centos-release-scl-rh-2-2.el7.centos.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : scl-utils-20130529-18.el7_4.x86_64                                                                                                                      1/11 
  Installing : rh-git29-runtime-2.3-4.el7.x86_64                                                                                                                       2/11 
  Installing : httpd24-runtime-1.1-18.el7.x86_64                                                                                                                       3/11 
  Installing : httpd24-libnghttp2-1.7.1-6.el7.x86_64                                                                                                                   4/11 
  Installing : httpd24-libcurl-7.47.1-4.el7.x86_64                                                                                                                     5/11 
  Installing : rh-git29-git-core-2.9.3-4.el7.x86_64                                                                                                                    6/11 
  Installing : rh-git29-git-core-doc-2.9.3-4.el7.x86_64                                                                                                                7/11 
  Installing : 1:emacs-filesystem-24.3-20.el7_4.noarch                                                                                                                 8/11 
  Installing : rh-git29-perl-Git-2.9.3-4.el7.noarch                                                                                                                    9/11 
  Installing : rh-git29-git-2.9.3-4.el7.x86_64                                                                                                                        10/11 
  Installing : rh-git29-2.3-4.el7.x86_64                                                                                                                              11/11 
  Verifying  : scl-utils-20130529-18.el7_4.x86_64                                                                                                                      1/11 
  Verifying  : 1:emacs-filesystem-24.3-20.el7_4.noarch                                                                                                                 2/11 
  Verifying  : rh-git29-perl-Git-2.9.3-4.el7.noarch                                                                                                                    3/11 
  Verifying  : rh-git29-git-core-2.9.3-4.el7.x86_64                                                                                                                    4/11 
  Verifying  : httpd24-runtime-1.1-18.el7.x86_64                                                                                                                       5/11 
  Verifying  : rh-git29-git-2.9.3-4.el7.x86_64                                                                                                                         6/11 
  Verifying  : rh-git29-runtime-2.3-4.el7.x86_64                                                                                                                       7/11 
  Verifying  : rh-git29-2.3-4.el7.x86_64                                                                                                                               8/11 
  Verifying  : rh-git29-git-core-doc-2.9.3-4.el7.x86_64                                                                                                                9/11 
  Verifying  : httpd24-libcurl-7.47.1-4.el7.x86_64                                                                                                                    10/11 
  Verifying  : httpd24-libnghttp2-1.7.1-6.el7.x86_64                                                                                                                  11/11 

Installed:
  rh-git29.x86_64 0:2.3-4.el7                                                                                                                                               

Dependency Installed:
  emacs-filesystem.noarch 1:24.3-20.el7_4   httpd24-libcurl.x86_64 0:7.47.1-4.el7    httpd24-libnghttp2.x86_64 0:1.7.1-6.el7      httpd24-runtime.x86_64 0:1.1-18.el7     
  rh-git29-git.x86_64 0:2.9.3-4.el7         rh-git29-git-core.x86_64 0:2.9.3-4.el7   rh-git29-git-core-doc.x86_64 0:2.9.3-4.el7   rh-git29-perl-Git.noarch 0:2.9.3-4.el7  
  rh-git29-runtime.x86_64 0:2.3-4.el7       scl-utils.x86_64 0:20130529-18.el7_4    

Complete!

Now you must use the newly installed git not the one with the system, you could create this file /etc/profile.d/enablegit29.sh containing the following:

#!/bin/bash
source scl_source enable rh-git29

After the above installation of SCL git 2.9 and creating this file you must log off and log in again to use the new git version.
So by default you will call always the installed SCL git:

myuser@local ~ $ ssh dev
Last login: Fri Sep 28 12:51:44 2018 from 10.10.10.10
[root@dev ~]# git --version
git version 2.9.3

No we can continue with upgrading out Bitbucket server.

STEP 4) Install the new Bitbucket 5.14.0

[root@dev ~]# ./atlassian-bitbucket-5.14.0-x64.bin 
Unpacking JRE ...
Starting Installer ...
2018-09-26 15:52:31,305 WARN  [main]  c.a.s.i.s.g.b.DefaultGitBinaryHelper /opt/rh/rh-git29/root/usr/bin/git is version 2.9.3. Bitbucket 6.0 will require Git 2.11.0 or higher.
Bitbucket 5.14.0 installation wizard
Would you like to install or upgrade an instance?
Install a new instance [1, Enter], Upgrade an existing instance [2]
2
Upgrade Bitbucket 5.14.0
What type of instance are you looking to upgrade?
Upgrade an existing Server instance [1, Enter], Upgrade an existing Data Center instance [2], Upgrade an existing Smart Mirroring instance [3]
1
Where should Bitbucket be installed?

[/opt/atlassian/bitbucket/5.14.0]

Default location for Bitbucket home directory

The location for Bitbucket data.
Please provide the location of your existing home directory, where your
repositories, plugins, and other data are stored.

Be sure to STOP your current instance and create a backup before proceeding.
[/var/atlassian/application-data/bitbucket]
/opt/atlassian/bitbucket/4.14.4 
The home directory structure could not be recognized. Please choose a valid home directory.
Default location for Bitbucket home directory

The location for Bitbucket data.
Please provide the location of your existing home directory, where your
repositories, plugins, and other data are stored.

Be sure to STOP your current instance and create a backup before proceeding.
[/var/atlassian/application-data/bitbucket]



We’ve changed where you can configure properties such as port, context path, and access protocol. The sever.xml file in the selected directory has customizations that will be ignored after the upgrade.

You need to move these customizations to the bitbucket.properties file. The file uses a different syntax, so refer to the upgrade guide for specific instructions:

https://confluence.atlassian.com/bitbucketserver/bitbucket-server-upgrade-guide-776640551.html#BitbucketServerupgradeguide-customchanges


I've read the upgrade guide and moved my customizations to the bitbucket.properties file.
Acknowledge [a, Enter], Exit [e]
a


Upgrading to Bitbucket disables all user-installed add-ons, whether they are 3rd-party add-ons from Atlassian Marketplace or your own custom add-ons.

User-installed add-ons will need to be checked, upgraded, and enabled again once you've finished the upgrade process. Read more about upgrading add-ons in the upgrade guide:

https://confluence.atlassian.com/display/BitbucketServer/Bitbucket+Server+upgrade+guide?utm_source=stash-installer&utm_medium=installer&utm_campaign=stash#BitbucketServerupgradeguide-40


I've read the upgrade guide and understand I will need to enable my add-ons again.
Acknowledge [a, Enter], Exit [e]
a
Please review your Bitbucket installation settings


Installation Directory: /opt/atlassian/bitbucket/5.14.0 
Home Directory: /var/atlassian/application-data/bitbucket 
Upgrade existing service: Yes 

Install [i, Enter], Exit [e]
i
2018-09-26 15:57:25,229 WARN  [main]  c.a.s.i.s.g.b.DefaultGitBinaryHelper /opt/rh/rh-git29/root/usr/bin/git is version 2.9.3. Bitbucket 6.0 will require Git 2.11.0 or higher.

Extracting files ...
                                                                           
Installation of Bitbucket is complete
Would you like to launch Bitbucket?
Yes [y, Enter], No [n]
n

An important note about changes to starting Bitbucket Server
Bitbucket Server standard startup commands have changed to automatically
start a new service that enabled code search.When starting Bitbucket Server
manually, ensure you start all required services using both of the following
command:service atlbitbucket start
Installation of Bitbucket 5.14.0 is complete
Your installation of Bitbucket 5.14.0 is now ready and can be accessed via
your browser.
Bitbucket 5.14.0 can be accessed at http://localhost:7990
Finishing installation ...

We do not want to start the server, because the we should transfer our configuration from server.xml to bitbucket.properties and install our JDBC Mysql Driver JAR file.

STEP 5) Install the MySQL driver and the (our custom) old configuration.

Because the new version is installed in a new directory:

[root@dev ~]# ls -altr /opt/atlassian/bitbucket/
total 16
drwxr-xr-x.  3 root         root         4096  5 Apr  2017 ..
drwxr-xr-x. 15 atlbitbucket atlbitbucket 4096  5 Apr  2017 4.14.4
drwxr-xr-x.  4 root         root         4096 26 Sep 15,57 .
drwxr-xr-x. 12 atlbitbucket atlbitbucket 4096 26 Sep 15,57 5.14.0

and the old Bitbucket expected the JAR share files to be in its home installed directory plus “/lib” (in our case /opt/atlassian/bitbucket/4.14.4/lib/mysql-connector-java-5.1.41-bin.jar), so we copy the MySQL driver to the new location, which the new version of Bitbucket can use to load the driver and from version 5.x this place makes the existence of the driver persistent after such upgrades, because it is in “/var/atlassian/application-data/bitbucket/lib/” – the metadata directory for the Bitbucket, which is the same for all installations. So in future upgrades you won’t copy this file anywhere, because all future versions could load it from this shared location.

cp /opt/atlassian/bitbucket/4.14.4/lib/mysql-connector-java-5.1.41-bin.jar /var/atlassian/application-data/bitbucket/lib/

And the next step is to transfer our custom configuration, which uses HTTPS (port 443) and NGINX proxy (in the shared directory again) – in “/var/atlassian/application-data/bitbucket/shared/bitbucket.properties” add the following:

server.port=7990
server.secure=true
server.scheme=https
server.proxy-port=443
server.proxy-name=dev.example.com
server.context-path=/bitbucket

The domain is different, of course.

STEP 6) Start the new Atlassian Bitbucket server

[root@dev ~]# systemctl daemon-reload
[root@dev ~]# systemctl start atlbitbucket.service
[root@dev ~]# pstree
systemd─┬─agetty
        ├─dbus-daemon
        ├─firewalld───{firewalld}
        ├─java───41*[{java}]
        ├─java───49*[{java}]
        ├─master─┬─pickup
        │        └─qmgr
        ├─mysqld───41*[{mysqld}]
        ├─nginx───nginx
        ├─polkitd───5*[{polkitd}]
        ├─rsyslogd───2*[{rsyslogd}]
        ├─sshd─┬─sshd───bash───pstree
        │      └─sshd───bash
        ├─systemd-journal
        └─systemd-logind
[root@dev ~]# netstat -anp|grep java
tcp6       0      0 :::7990                 :::*                    LISTEN      1585/java           
tcp6       0      0 127.0.0.1:7992          :::*                    LISTEN      1562/java           
tcp6       0      0 ::1:7992                :::*                    LISTEN      1562/java           
tcp6       0      0 127.0.0.1:7993          :::*                    LISTEN      1562/java           
tcp6       0      0 ::1:7993                :::*                    LISTEN      1562/java           
unix  2      [ ]         STREAM     CONNECTED     598776914 1562/java            
unix  2      [ ]         STREAM     CONNECTED     598771458 1562/java            
unix  2      [ ]         STREAM     CONNECTED     598777000 1585/java            
unix  2      [ ]         STREAM     CONNECTED     598772365 1585/java            

As an extra information we have included the pstree and netstat output to see if the java processes are there.
Now you can load your bitbucket url https://dev.example.com/bitbucket and at first you could see an upgrade window:

main menu
Upgrading your home Bitbucket directory

Troubleshooting

If you encounter the following error in the web:

A fatal error has occurred

The following problem occurred, which prevents Atlassian Bitbucket from starting:

    The database, as currently configured, is not accessible.

If you check the logs (especially “/var/atlassian/application-data/bitbucket/log/atlassian-bitbucket.log”) you should see something like:

ERROR [spring-startup] com.zaxxer.hikari.HikariConfig Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader

2018-09-27 12:40:50,042 INFO  [main]  o.s.boot.SpringApplication 
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.12.RELEASE)


2018-09-27 12:40:50,314 INFO  [main]  c.a.b.i.b.BitbucketServerApplication Starting BitbucketServerApplication on dev.bgtime.tv with PID 4002 (/opt/atlassian/bitbucket/5.14.0/app/WEB-INF/classes started by atlbitbucket in /)
2018-09-27 12:40:50,314 INFO  [main]  c.a.b.i.b.BitbucketServerApplication No active profile set, falling back to default profiles: default
2018-09-27 12:40:51,484 INFO  [main]  c.a.b.i.boot.log.BuildInfoLogger Starting Bitbucket 5.14.0 (3e34d93 built on Sun Sep 09 08:43:29 UTC 2018)
2018-09-27 12:40:51,484 INFO  [main]  c.a.b.i.boot.log.BuildInfoLogger JVM: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 1.8.0_172-b11
2018-09-27 12:40:53,012 INFO  [main]  c.a.b.i.b.BitbucketServerApplication Started BitbucketServerApplication in 3.821 seconds (JVM running for 5.245)
2018-09-27 12:40:55,848 INFO  [spring-startup]  c.a.s.internal.home.HomeLockAcquirer Successfully acquired lock on home directory /var/atlassian/application-data/bitbucket
2018-09-27 12:40:56,253 ERROR [spring-startup]  com.zaxxer.hikari.HikariConfig Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader@65ab7765
2018-09-27 12:40:56,863 ERROR [spring-startup]  com.zaxxer.hikari.HikariConfig Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader@65ab7765
2018-09-27 12:40:56,871 ERROR [spring-startup]  com.zaxxer.hikari.HikariConfig Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader@65ab7765
2018-09-27 12:40:56,893 ERROR [spring-startup]  com.zaxxer.hikari.HikariConfig Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader@65ab7765
2018-09-27 12:40:56,924 ERROR [spring-startup]  com.zaxxer.hikari.HikariConfig Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader@65ab7765
2018-09-27 12:40:56,934 ERROR [spring-startup]  com.zaxxer.hikari.HikariConfig Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader@65ab7765
2018-09-27 12:40:56,940 ERROR [spring-startup]  com.zaxxer.hikari.HikariConfig Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader@65ab7765
2018-09-27 12:40:56,944 ERROR [spring-startup]  com.zaxxer.hikari.HikariConfig Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader@65ab7765
2018-09-27 12:40:56,945 WARN  [spring-startup]  o.s.w.c.s.XmlWebApplicationContext Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdAliasDao': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sharedHomeLockAcquirer' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'licenseHelper' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'licenseHelper' defined in URL [jar:file:/opt/atlassian/bitbucket/5.14.0/app/WEB-INF/lib/bitbucket-service-impl-5.14.0.jar!/com/atlassian/stash/internal/license/DefaultLicenseHelper.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'databaseSupplier' defined in URL [jar:file:/opt/atlassian/bitbucket/5.14.0/app/WEB-INF/lib/bitbucket-dao-impl-5.14.0.jar!/com/atlassian/stash/internal/db/DefaultDatabaseSupplier.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [stash-context.xml]: Cannot create inner bean 'dataSourceFactory$created#3aae6fd0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceFactory$created#3aae6fd0' defined in class path resource [stash-context.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'create' threw exception; nested exception is java.lang.RuntimeException: Failed to load driver class com.mysql.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'dataSource' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [stash-context.xml]: Cannot create inner bean 'dataSourceFactory$created#3aae6fd0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceFactory$created#3aae6fd0' defined in class path resource [stash-context.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'create' threw exception; nested exception is java.lang.RuntimeException: Failed to load driver class com.mysql.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'dataSource' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [stash-context.xml]: Cannot create inner bean 'dataSourceFactory$created#3aae6fd0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceFactory$created#3aae6fd0' defined in class path resource [stash-context.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'create' threw exception; nested exception is java.lang.RuntimeException: Failed to load driver class com.mysql.jdbc.Driver in either of HikariConfig class loader or Thread context classloader

You probably did not put the JDBC MySQL file in the new shared location before starting up the new installation. Stop you Bitbucket server, copy the file and start it up:

[root@dev ~]# systemctl stop atlbitbucket.service
[root@dev ~]# cp /opt/atlassian/bitbucket/4.14.4/lib/mysql-connector-java-5.1.41-bin.jar /var/atlassian/application-data/bitbucket/lib/
[root@dev ~]# systemctl start atlbitbucket.service

Of course, your “mysql-connector-java-” could be some other version, just copy the file starting with mysql-connector-java-* to the above directory.

Leave a Reply

Your email address will not be published. Required fields are marked *