net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem

Atlassian JIRA | Don Willis [Atlassian] | 6 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Mark H tried to import data into Extranet and it failed. There were a couple of errors about failing to remove the temp/import directories early on, which are weird because I don't get why there are two of them (and there are indeed two identical import directories in temp containing identically sized entities.xml files. Then much later there was an UnresolvableObjectException. It may be relevant that the instance was (and is) doing a full re-index at the time. Afterwards, the space seemed to be somewhat intact but without any attachments. The stacktraces were: {noformat} 2011-10-11 00:47:25,434 ERROR [Long running task: Importing data] [sf.hibernate.impl.IteratorImpl] next could not get next result -- referer: https://extranet.atlassian.com/admin/backup.action | url: /admin/restore.action | userName: mhrynczak | act ion: restore net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 1948483595, of class: com.atlassi an.confluence.pages.Attachment at net.sf.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:38) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69) at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:208) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:130) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:93) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:127) at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachm entCopier.copy(AbstractHibernateAttachmentDao.java:398) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importAttachments(FileBackupImporter.java: 335) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:1 15) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.doImportInternal(BackupImporter.java:108) at com.atlassian.confluence.importexport.Importer.doImport(Importer.java:74) at com.atlassian.confluence.importexport.DefaultImportExportManager.importAs(DefaultImportExportManager.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java: 182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy85.importAs(Unknown Source) at com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:58 ) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunning Task.java:21) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:35) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) {noformat} and {noformat} 2011-10-11 00:47:25,434 ERROR [Long running task: Importing data] [sf.hibernate.impl.IteratorImpl] next could not get next result -- referer: https://extranet.atlassian.com/admin/backup.action | url: /admin/restore.action | userName: mhrynczak | action: restore net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:133) at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentCopier.copy(AbstractHibernateAttachmentDao.java:398) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importAttachments(FileBackupImporter.java:335) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:115) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.doImportInternal(BackupImporter.java:108) at com.atlassian.confluence.importexport.Importer.doImport(Importer.java:74) at com.atlassian.confluence.importexport.DefaultImportExportManager.importAs(DefaultImportExportManager.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy85.importAs(Unknown Source) at com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:58) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:21) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:35) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 1948483595, of class: com.atlassian.confluence.pages.Attachment at net.sf.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:38) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69) at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:208) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:130) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:93) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:127) ... 26 more {noformat}

    Atlassian JIRA | 6 years ago | Don Willis [Atlassian]
    net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem
  2. 0

    Mark H tried to import data into Extranet and it failed. There were a couple of errors about failing to remove the temp/import directories early on, which are weird because I don't get why there are two of them (and there are indeed two identical import directories in temp containing identically sized entities.xml files. Then much later there was an UnresolvableObjectException. It may be relevant that the instance was (and is) doing a full re-index at the time. Afterwards, the space seemed to be somewhat intact but without any attachments. The stacktraces were: {noformat} 2011-10-11 00:47:25,434 ERROR [Long running task: Importing data] [sf.hibernate.impl.IteratorImpl] next could not get next result -- referer: https://extranet.atlassian.com/admin/backup.action | url: /admin/restore.action | userName: mhrynczak | act ion: restore net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 1948483595, of class: com.atlassi an.confluence.pages.Attachment at net.sf.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:38) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69) at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:208) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:130) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:93) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:127) at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachm entCopier.copy(AbstractHibernateAttachmentDao.java:398) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importAttachments(FileBackupImporter.java: 335) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:1 15) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.doImportInternal(BackupImporter.java:108) at com.atlassian.confluence.importexport.Importer.doImport(Importer.java:74) at com.atlassian.confluence.importexport.DefaultImportExportManager.importAs(DefaultImportExportManager.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java: 182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy85.importAs(Unknown Source) at com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:58 ) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunning Task.java:21) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:35) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) {noformat} and {noformat} 2011-10-11 00:47:25,434 ERROR [Long running task: Importing data] [sf.hibernate.impl.IteratorImpl] next could not get next result -- referer: https://extranet.atlassian.com/admin/backup.action | url: /admin/restore.action | userName: mhrynczak | action: restore net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:133) at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentCopier.copy(AbstractHibernateAttachmentDao.java:398) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importAttachments(FileBackupImporter.java:335) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:115) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.doImportInternal(BackupImporter.java:108) at com.atlassian.confluence.importexport.Importer.doImport(Importer.java:74) at com.atlassian.confluence.importexport.DefaultImportExportManager.importAs(DefaultImportExportManager.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy85.importAs(Unknown Source) at com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:58) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:21) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:35) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 1948483595, of class: com.atlassian.confluence.pages.Attachment at net.sf.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:38) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69) at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:208) at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:130) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:93) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:127) ... 26 more {noformat}

    Atlassian JIRA | 6 years ago | Don Willis [Atlassian]
    net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. net.sf.hibernate.UnresolvableObjectException

      No row with the given identifier exists: 1948483595, of class: com.atlassian.confluence.pages.Attachment

      at net.sf.hibernate.UnresolvableObjectException.throwIfNull()
    2. net.sf.hibernate
      IteratorImpl.next
      1. net.sf.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:38)
      2. net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
      3. net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
      4. net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:208)
      5. net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:130)
      6. net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:93)
      7. net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:127)
      7 frames
    3. com.atlassian.confluence
      DefaultImportExportManager.importAs
      1. com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentCopier.copy(AbstractHibernateAttachmentDao.java:398)
      2. com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importAttachments(FileBackupImporter.java:335)
      3. com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:115)
      4. com.atlassian.confluence.importexport.xmlimport.BackupImporter.doImportInternal(BackupImporter.java:108)
      5. com.atlassian.confluence.importexport.Importer.doImport(Importer.java:74)
      6. com.atlassian.confluence.importexport.DefaultImportExportManager.importAs(DefaultImportExportManager.java:67)
      6 frames
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    5. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      3 frames
    6. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      1 frame
    7. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames
    8. Unknown
      $Proxy85.importAs
      1. $Proxy85.importAs(Unknown Source)
      1 frame
    9. com.atlassian.confluence
      ManagedTask.run
      1. com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:58)
      2. com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:21)
      3. com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:35)
      3 frames
    10. Java RT
      Thread.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      2. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      3. java.util.concurrent.FutureTask.run(FutureTask.java:138)
      4. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      5. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      6. java.lang.Thread.run(Thread.java:662)
      6 frames