Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Restoring with the Stash Backup Client: The configured JDBC driver is not available

agcal December 11, 2014

Hi all

I'm totally new to these applications, so the solution to my problem will be easy hopefully!

Context

I have a backup of Stash taken with the Stash Backup Client.

I'm trying to do a test restore from that backup on another machine.

Problem

When I run the restore command it fails with the following error:

$ java -jar stash-restore-client.jar /root/restore/stash/backups/stash-20141210-205945-019.tar
 
...
 
The configured JDBC driver, mysql-connector-java-5.1.34-bin.jar, is not available on the classpath. Ensure the jar for the driver is present in the "jdbc" directory beneath /root/stash-backup-client-1.6.0/. and try again.

Preparation Steps for Restore

I have downloaded the Stash Backup Client and stop the atlassian applications on the machine

$ wget https://maven.atlassian.com/content/repositories/atlassian-public/com/atlassian/stash/backup/stash-backup-distribution/1.6.0/stash-backup-distribution-1.6.0.zip
$ unzip stash-backup-distribution-1.6.0.zip
$ rm stash-backup-distribution-1.6.0.zip
$ service jira stop
$ service atlstash stop

copied the mysql driver into "jdbc" directory beneath /root/stash-backup-client-1.6.0/

$ cp /opt/atlassian/stash/3.5.0/lib/mysql-connector-java-5.1.34-bin.jar stash-backup-client-1.6.0/jdbc/
 
$ tree stash-backup-client-1.6.0
stash-backup-client-1.6.0/
├── backup-config.properties
├── jdbc
    ├── hsqldb-2.2.4.jar
    ├── mysql-connector-java-5.1.34-bin.jar
    ├── ojdbc6-11.2.0.2.0.jar
    ├── postgresql-9.3-1102-jdbc41.jar
    └── sqljdbc-4.0.2206.jar

edited backup-config.properties

$ cat backup-config.properties
 
...
stash.home=/var/atlassian/application-data/stash
...
jdbc.override=true
jdbc.driver=mysql-connector-java-5.1.34-bin.jar
jdbc.url=jdbc:mysql://localhost:3306/scstdb?autoReconnect=true&characterEncoding=utf8&useUnicode=true&sessionVariables=storage_engine%3DInnoDB
jdbc.user=root
jdbc.password=test123

installed java

$ apt install default-jre
$ java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

created a new empty database and a mysql user with access to this database

$ mysql -u root -p
DROP DATABASE scstdb;
CREATE DATABASE scstdb CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON scstdb.* TO 'scstu'@'localhost' IDENTIFIED BY 'test123';
FLUSH PRIVILEGES;
QUIT

emptied the home directory

$ cd /var/atlassian/application-data/stash
$ rm -r *
$ rm -r .*

activated debug logging

$ cd ~/stash-backup-client-1.6.0
$ echo "<included><logger name="com.atlassian.stash" level="DEBUG"/></included>" > logback.xml

then attempted to restore the backup

$ cd ~/stash-backup-client-1.6.0
$ java -jar stash-restore-client.jar /root/restore/stash/backups/stash-20141210-205945-019.tar

the log/ contains and the output to terminal can be seen here

cat log/atlassian-sbc-2014-12-11-1514.log 
2014-12-11 15:14:04,877 INFO  [main] c.a.s.i.b.client.spring.SpringMain Initializing
2014-12-11 15:14:06,761 INFO  [main] c.a.s.i.b.c.DefaultRestoreClient Unpacking stash-20141210-205945-019.tar to /var/atlassian/application-data/stash
2014-12-11 15:14:08,330 ERROR [main] c.a.s.i.backup.client.RestoreMain stash-20141210-205945-019.tar could not be restored. Reason: The configured JDBC driver, mysql-connector-java-5.1.34-bin.jar, is not available on the classpath. Ensure the jar for the driver is present in the "jdbc" directory beneath /root/stash-backup-client-1.6.0/. and try again.
com.atlassian.stash.internal.backup.client.RestoreException: The configured JDBC driver, mysql-connector-java-5.1.34-bin.jar, is not available on the classpath. Ensure the jar for the driver is present in the "jdbc" directory beneath /root/stash-backup-client-1.6.0/. and try again.
	at com.atlassian.stash.internal.backup.client.DefaultRestoreClient.createDataSource(DefaultRestoreClient.groovy:165) ~[stash-restore-client.jar:1.6.0]
	at com.atlassian.stash.internal.backup.client.DefaultRestoreClient.withDataSource(DefaultRestoreClient.groovy:264) ~[stash-restore-client.jar:1.6.0]
	at com.atlassian.stash.internal.backup.client.DefaultRestoreClient.restoreDatabase(DefaultRestoreClient.groovy:218) ~[stash-restore-client.jar:1.6.0]
	at com.atlassian.stash.internal.backup.client.DefaultRestoreClient.restoreSystem(DefaultRestoreClient.groovy:252) ~[stash-restore-client.jar:1.6.0]
	at com.atlassian.stash.internal.backup.client.DefaultRestoreClient.restore(DefaultRestoreClient.groovy:83) ~[stash-restore-client.jar:1.6.0]
	at com.atlassian.stash.internal.backup.client.spring.SpringMain.run(SpringMain.groovy:28) [stash-backup-core-1.6.0.jar:na]
	at com.atlassian.stash.internal.backup.client.RestoreMain.main(RestoreMain.groovy:55) [stash-restore-client.jar:1.6.0]
	at com.atlassian.stash.internal.backup.client.JavaVersionCheckingShim.invokeClientClassMain(JavaVersionCheckingShim.java:71) [stash-restore-client.jar:1.6.0]
	at com.atlassian.stash.internal.backup.client.JavaVersionCheckingShim.run(JavaVersionCheckingShim.java:85) [stash-restore-client.jar:1.6.0]
	... 49 frames suppressed
Caused by: java.lang.ClassNotFoundException: mysql-connector-java-5.1.34-bin.jar
	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_65]
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_65]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[na:1.7.0_65]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[na:1.7.0_65]
	at java.lang.Class.forName0(Native Method) ~[na:1.7.0_65]
	at java.lang.Class.forName(Class.java:191) ~[na:1.7.0_65]
	at com.atlassian.stash.internal.backup.client.DefaultRestoreClient.createDataSource(DefaultRestoreClient.groovy:161) ~[stash-restore-client.jar:1.6.0]
	... 47 common frames omitted
	... 3 frames suppressed

This is on Ubuntu Server 14.04.1 x86_64.

Thanks for the help

 

1 answer

1 accepted

2 votes
Answer accepted
agcal December 11, 2014

ah maybe

jdbc.driver=mysql-connector-java-5.1.34-bin.jar

should be

jdbc.driver=com.mysql.jdbc.Driver

 

Edited:

This was the cause of the error.

I'll leave this here in case it helps anyone else.

Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events