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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

0 votes
Answer 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 votes
rsperafico Atlassian Team Jun 13, 2014

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
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

2,369 views 1 8
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you