Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cron job for backup client gives exceptions

Morten Flydahl
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2016

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

1 vote
Answer accepted
ThiagoBomfim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 10, 2016

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

Morten Flydahl
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2016

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

ThiagoBomfim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 11, 2016

Not a problem! Glad it helped. smile

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events