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

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

0 vote

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

71 views 0 11
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