java.lang.ClassCastException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • When using file-based directory configuration, any backup (manual or scheduled) fails and produces the following stacktrace: {noformat} 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) {noformat} h2. Workaround Disable scheduled backups and abstain from doing manual backups when using the file-based directory configuration.
    via by Diego Berrueta Munoz,
  • When using file-based directory configuration, any backup (manual or scheduled) fails and produces the following stacktrace: {noformat} 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) {noformat} h2. Workaround Disable scheduled backups and abstain from doing manual backups when using the file-based directory configuration.
    via by Diego Berrueta,
  • Trying to do backup or restore when recovery mode is enabled will fail, with a 500 server error: Restore: {code} Caused by: java.lang.RuntimeException: com.atlassian.crowd.exception.DirectoryNotFoundException: Directory <-2> does not exist at com.atlassian.crowd.console.action.admin.Backup.getSynchronisingDirectoryNames(Backup.java:208) at com.atlassian.crowd.console.action.admin.Backup.doImportValidation(Backup.java:77) at com.atlassian.crowd.console.action.admin.Backup.doImport(Backup.java:129) ... 156 more Caused by: com.atlassian.crowd.exception.DirectoryNotFoundException: Directory <-2> does not exist at com.atlassian.crowd.dao.directory.DirectoryDAOHibernate.findById(DirectoryDAOHibernate.java:61) at com.atlassian.crowd.dao.directory.DirectoryDAOHibernate.findById(DirectoryDAOHibernate.java:26) at com.atlassian.crowd.manager.directory.DirectorySynchroniserHelperImpl.findDirectoryById(DirectorySynchroniserHelperImpl.java:85) at com.atlassian.crowd.manager.directory.DirectorySynchroniserHelperImpl.isSynchronising(DirectorySynchroniserHelperImpl.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) {code} Backup: {code} java.lang.ClassCastException: com.atlassian.crowd.manager.recovery.RecoveryModeDirectory 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:33) at com.atlassian.crowd.migration.XmlMigrationManagerImpl.exportXml(XmlMigrationManagerImpl.java:104) 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:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) 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.$Proxy63.backup(Unknown Source) at com.atlassian.crowd.console.action.admin.Backup.doExport(Backup.java:105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:891) at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1293) {code}
    via by Lukasz Pater,
    • 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:51) 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:601) 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 $Proxy48.backup(Unknown Source) at com.atlassian.crowd.manager.backup.BackupJob.executeInternal(BackupJob.java:30) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113) at org.quartz.core.JobRunShell.run(JobRunShell.java:203) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
    No Bugmate found.