Stash backup client failed with Java exception.

Hello,

We're using Stash v3.0.1 on Amazon m3.medium instance type and I've setup simple backup cronjob using stash backup client but it failed and now when issue that manually it fails too.
Cronjob is simple:

30 00 * * * cd /path/to/backup && ./stash-backup

stash-backup script:

#!/bin/bash
#
# Daily backup of Stash Server.
#



DATE=$(date +%Y-%m-%d-%H_%M)
STASH_PASS="<password>"
STASH_USER="<stash-user>"
URL="http://<stash-link>"
STASH_ROOT="<stash/path>"
STASH_HOME="${STASH_ROOT}/data"
BACKUP_DIR="${STASH_ROOT}/backup/backups"
LOG_DIR="${STASH_ROOT}/backup/log"
#BACKUP_LOG="${LOG_DIR}/atlassian-sbc-" # to do
RECIPIENT="<user1>"
RETVAL=$?

MESSAGE() {
    echo "Check log file under  ${LOG_DIR}" |  /bin/mail -s "AHA Stash Backup FAILED with return code $RETVAL" ${RECIPIENT}
}

PROCESS() {
/usr/bin/java -Dstash.password="${PASS}" -Dstash.user="${STASH_USER}" -Dstash.baseUrl="${URL}" -Dstash.home="${STASH_HOME}" -jar <path/to>/stash-backup-client-1.2.1/stash-backup-client.jar stash-${DATE}.tar
}

PROCESS
#${RETVAL}
if [ ${RETVAL} -ne "0" ]; then
    MESSAGE
fi

When i execute it from command line here's what I get:

Exception in thread "main" java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyObject
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 13 more

Any help appreciated,

Thank you



3 answers

1 accepted

This widget could not be displayed.

The reason why i was having that issue was because I extracted the package and copied over only 2 files stash backup restore and backup jar files and I learned later that these files are using libraries that are included in tar file.

Thanks

This widget could not be displayed.

Hello,

It seems the issue is related to a version mismatch of Groovy. More specifically, it seemed it is running a compiled groovy class under A.B.C where it was compiled under X.Y.Z

Changing the library included on the classpath to X.Y.Z might resolve the issue.

I will run some tests and let you know.

Kind regards,
Rafael

This widget could not be displayed.

Hey Rafael,

Thanks for looking into that but I was wonder how that would change since there were no updates and that backup was working at the very beggining.

Is there a package that would change the version or something like that? We haven't compiled anything, just downloaded packages and started using it as that what it states to do on documentation page if we go with stash-backup-client?

Thanks,

E.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published yesterday in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

81 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you