Cron job for backup client gives exceptions

I'm trying to setup a crontab for running backup on an Ubuntu Server 16.04, and I'm getting exceptions randomly. The cron job is set up correctly, using webmin.

The exception I get is:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'appHome' defined in class path resource [META-INF/spring/common-spring.xml]: Could not resolve placeholder 'bitbucket.home' in string value "${bitbucket.home}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'bitbucket.home' in string value "${bitbucket.home}"
2016-10-10 21:51:01,545 ERROR        BITBUCKET_HOME is not defined.
Creating a backup requires direct, filesystem access to BITBUCKET_HOME for the instance being backed up, in order to backup its repositories.
BITBUCKET_HOME may be set using an environment variable, a system property (bitbucket.home) or configured in backup-config.properties.
When running the job manually with:

The BICKBUCKET_HOME variable is

/var/atlassian/application-data/bitbucket

This is also set in backup-config.properties, in bitbucket.home=.

 

When I ran it manually as the user "root" the first five or so times with the following command

java jar /home/userwtih-root-premission/bitbucket-backup-client-3.3.0/bitbucket-backup-client.jar

it was all good, until i suddenly got the following exception:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'restClient' defined in class path resource [META-INF/spring/backup-spring.xml]: Could not resolve placeholder 'bitbucket.password' in string value "${bitbucket.password}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'bitbucket.password' in string value "${bitbucket.password}"

All the environment variables are set. All the values are set in backup-config.properties, and of course they are set correctly, since I could run it manually the first few times.

I have no idea why I'm experiencing this strange behavior. Please help me find a solution. If I must provide more information, please tell me what information you require, and where I find it if it's a log file or something.

Best regards,

Morten

1 answer

1 accepted

This widget could not be displayed.

Hi Morten,

The bitbucket.properties file is read from wherever directory you run the java command. On your cronjob, are you doing a cd to the directory where this file is before executing? Same question applies for the case when you're running as root.

Regards,

Thiago

That was it. I changed my cronjob to:

08 09 * * * cd /home/user-with-root-permission/bitbucket-backup-client-3.3.0 && java -jar bitbucket-backup-client.jar

Thank you smile

Not a problem! Glad it helped. smile

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,279 views 8 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