Manual and scheduled backup fails when using file-based directory configuration
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Problem
XML backup export (manual or scheduled) fails and produces the following stacktrace in the atlassian-crowd.log:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2015-06-23 02:00:00,034 scheduler_Worker-1 ERROR [atlassian.scheduler.core.JobLauncher] Scheduled job with ID 'AutomatedBackup' failed
java.lang.ClassCastException: com.atlassian.crowd.dao.directory.ImmutableDirectory cannot be cast to com.atlassian.crowd.model.directory.DirectoryImpl
at com.atlassian.crowd.migration.DirectoryMapper.exportXml(DirectoryMapper.java:52)
at com.atlassian.crowd.migration.XmlMigrator.exportXml(XmlMigrator.java:36)
at com.atlassian.crowd.migration.XmlMigrationManagerImpl.exportXml(XmlMigrationManagerImpl.java:106)
at com.atlassian.crowd.manager.backup.DefaultBackupManager.backup(DefaultBackupManager.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy56.backup(Unknown Source)
at com.atlassian.crowd.manager.backup.BackupJobRunner.runJob(BackupJobRunner.java:37)
at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135)
at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)
at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)
at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
or:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
java.lang.ClassCastException: com.atlassian.crowd.dao.directory.ImmutableDirectory cannot be cast to com.atlassian.crowd.model.directory.DirectoryImpl
#011at com.atlassian.crowd.migration.DirectoryMapper.exportXml(DirectoryMapper.java:51)
#011at com.atlassian.crowd.migration.XmlMigrator.exportXml(XmlMigrator.java:36)
#011at com.atlassian.crowd.migration.XmlMigrationManagerImpl.exportXml(XmlMigrationManagerImpl.java:106)
#011at com.atlassian.crowd.manager.backup.DefaultBackupManager.backup(DefaultBackupManager.java:73)
#011at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
#011at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
#011at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
#011at java.lang.reflect.Method.invoke(Method.java:601)
#011at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
#011at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
#011at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
#011at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
#011at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
#011at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
#011at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
#011at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
#011at $Proxy48.backup(Unknown Source)
#011at com.atlassian.crowd.manager.backup.BackupJob.executeInternal(BackupJob.java:30)
#011at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113)
#011at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
#011at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Diagnosis
Check if there is a file named directory.properties under Finding your Crowd home and shared directories
Cause
If you have moved the directory.properties to your <crowd_home> directory, then you have accidentally enabled the file-based directory configuration.
The existence of this file directly in the <crowd_home> directory (regardless of its contents) enables the feature, which triggered this bug: CWD-3001 Externalise directory configuration from the database
Solution
Resolution
Remove the file directory.properties from the <crowd_home> directory
Restart crowd
ℹ️ Having the file directory.properties in <crowd_home>/backup/ is fine and will not trigger this bug.
Was this helpful?