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

Atlassian JIRA | Dave Loeng [Atlassian] | 1 decade ago
  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 | 5 years ago | Don Willis [Atlassian]
    net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 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 | 5 years ago | Don Willis [Atlassian]
    net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem
  4. 0

    Is it legal to map a many-to-one class to an interface. I have done this with the father property (in the attached example), however, I am receiving errors when I try to load records where the parent property is not null. I have attached a set of files that demonstrate the error I am getting. To use: 1. run the sql script to build files and populate data Note: I'm using MySQL so you might have to change for a different DB 2. Change eg.test configuration properites to reflect your DB setup 3. Run eg.test Everything should work fine and "Detail B1 - F3" should be printed to the output 4. Now in eg.test, change the configuration to use eg.IFather instead of eg.Father 5. In IDetail, change the m-1 father property from eg.Father to eg.IFather 6. Re-run and you will get this error. Exception in thread "main" java.lang.IllegalArgumentException: No visible constructors in interface eg.IFather at net.sf.cglib.EnhancerGenerator.<init>(EnhancerGenerator.java:128) at net.sf.cglib.Enhancer.enhanceClassHelper(Enhancer.java:224) at net.sf.cglib.Enhancer.enhanceHelper(Enhancer.java:206) at net.sf.cglib.Enhancer.enhance(Enhancer.java:162) at net.sf.cglib.Enhancer.enhance(Enhancer.java:139) at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:26) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1790) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901) at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710) at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:48) at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:55) at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153) at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49) at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>) at com.test.main(test.java:39) rethrown as net.sf.hibernate.HibernateException: CGLIB Enhancement failed: No visible constructors in interface eg.IFather at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:37) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1790) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901) at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710) at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:48) at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:55) at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153) at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49) at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>) at com.test.main(test.java:39) rethrown as net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem: CGLIB Enhancement failed: No visible constructors in interface eg.IFather at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:59) at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153) at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49) at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>) at eq.test.main(test.java:43) Chris....

    Hibernate JIRA | 1 decade ago | Chris Hane
    net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem: CGLIB Enhancement failed: No visible constructors in interface eg.IFather

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. net.sf.hibernate.LazyInitializationException

      Hibernate lazy instantiation problem

      at net.sf.hibernate.impl.IteratorImpl.next()
    2. net.sf.hibernate
      IteratorImpl.next
      1. net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:97)
      1 frame
    3. com.atlassian.confluence
      ViewSpaceAction.getRecentlyUpdatedContent
      1. com.atlassian.confluence.spaces.actions.ViewSpaceAction.getRecentlyUpdatedContent(ViewSpaceAction.java:104)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor1068.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:324)
      3 frames
    5. OGNL - Object Graph Navigation Library
      OgnlRuntime.getProperty
      1. ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:321)
      2. ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:729)
      3. ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:54)
      4. ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:122)
      5. ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1444)
      5 frames
    6. XWork Tiger Extensions
      CompoundRootAccessor.getProperty
      1. com.opensymphony.xwork.util.CompoundRootAccessor.getProperty(CompoundRootAccessor.java:98)
      1 frame
    7. OGNL - Object Graph Navigation Library
      Ognl.getValue
      1. ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1444)
      2. ognl.ASTProperty.getValueBody(ASTProperty.java:96)
      3. ognl.SimpleNode.getValue(SimpleNode.java:167)
      4. ognl.Ognl.getValue(Ognl.java:335)
      5. ognl.Ognl.getValue(Ognl.java:310)
      5 frames