org.hibernate.LazyInitializationException: illegal access to loading collection

AppFuse JIRA | Mike Kelland | 9 years ago
  1. 0

    When the POJO's are generated with mvn appfuse:gen-model the resulting code throws an exception trace as shown below on unit test due to persistent Set objects being included in the hashCode calculation: btw - I think that this gen-model functionality is fantastic. kudos! ERROR [main] LazyInitializationException.<init>(19) | illegal access to loading collection org.hibernate.LazyInitializationException: illegal access to loading collection at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:411) at com.clarestow.myproject.model.MediaIdentifier.hashCode(MediaIdentifier.java:78) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157) at com.clarestow.myproject.model.MediaIdentifier$$EnhancerByCGLIB$$f7b21f30.hashCode(<generated>) at com.clarestow.myproject.model.TitleIdentifier.hashCode(TitleIdentifier.java:89) at java.util.HashMap.put(Unknown Source) at java.util.HashSet.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:329) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:237) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195) at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865) at org.hibernate.loader.Loader.doQuery(Loader.java:729) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.loadCollection(Loader.java:1994) at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:411) at com.clarestow.myproject.model.MediaIdentifier.hashCode(MediaIdentifier.java:78) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157) at com.clarestow.myproject.model.MediaIdentifier$$EnhancerByCGLIB$$f7b21f30.hashCode(<generated>) at com.clarestow.myproject.model.Marketplace.hashCode(Marketplace.java:154) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157) at com.clarestow.myproject.model.Marketplace$$EnhancerByCGLIB$$5dcfe0ce.hashCode(<generated>) at com.clarestow.myproject.model.Certification.hashCode(Certification.java:102) at java.util.HashMap.put(Unknown Source) at java.util.HashSet.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:329) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:237) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195) at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865) at org.hibernate.loader.Loader.doQuery(Loader.java:729) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.loadCollection(Loader.java:1994) at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:411) at com.clarestow.myproject.model.MediaTitle.hashCode(MediaTitle.java:157) at java.util.HashMap.put(Unknown Source) at java.util.HashSet.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:329) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:237) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195) at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865) at org.hibernate.loader.Loader.doQuery(Loader.java:729) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.loadCollection(Loader.java:1994) at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163) at org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:211) at org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:200) at org.hibernate.engine.CascadingAction.getAllElementsIterator(CascadingAction.java:415) at org.hibernate.engine.CascadingAction.access$100(CascadingAction.java:27) at org.hibernate.engine.CascadingAction$1.getCascadableChildrenIterator(CascadingAction.java:125) at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:294) at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169) at org.hibernate.engine.Cascade.cascade(Cascade.java:130) at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBeforeDelete(DefaultDeleteEventListener.java:307) at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:246) at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:141) at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:52) at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:766) at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744) at org.springframework.orm.hibernate3.HibernateTemplate$25.doInHibernate(HibernateTemplate.java:790) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372) at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:784) at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:780) at org.appfuse.dao.hibernate.GenericDaoHibernate.remove(GenericDaoHibernate.java:88) at org.appfuse.service.impl.GenericManagerImpl.remove(GenericManagerImpl.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy27.remove(Unknown Source) at com.clarestow.myproject.webapp.action.MediaTypeAction.delete(MediaTypeAction.java:55) at com.clarestow.myproject.webapp.action.MediaTypeActionTest.testRemove(MediaTypeActionTest.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    AppFuse JIRA | 9 years ago | Mike Kelland
    org.hibernate.LazyInitializationException: illegal access to loading collection
  2. 0

    When the POJO's are generated with mvn appfuse:gen-model the resulting code throws an exception trace as shown below on unit test due to persistent Set objects being included in the hashCode calculation: btw - I think that this gen-model functionality is fantastic. kudos! ERROR [main] LazyInitializationException.<init>(19) | illegal access to loading collection org.hibernate.LazyInitializationException: illegal access to loading collection at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:411) at com.clarestow.myproject.model.MediaIdentifier.hashCode(MediaIdentifier.java:78) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157) at com.clarestow.myproject.model.MediaIdentifier$$EnhancerByCGLIB$$f7b21f30.hashCode(<generated>) at com.clarestow.myproject.model.TitleIdentifier.hashCode(TitleIdentifier.java:89) at java.util.HashMap.put(Unknown Source) at java.util.HashSet.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:329) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:237) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195) at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865) at org.hibernate.loader.Loader.doQuery(Loader.java:729) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.loadCollection(Loader.java:1994) at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:411) at com.clarestow.myproject.model.MediaIdentifier.hashCode(MediaIdentifier.java:78) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157) at com.clarestow.myproject.model.MediaIdentifier$$EnhancerByCGLIB$$f7b21f30.hashCode(<generated>) at com.clarestow.myproject.model.Marketplace.hashCode(Marketplace.java:154) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157) at com.clarestow.myproject.model.Marketplace$$EnhancerByCGLIB$$5dcfe0ce.hashCode(<generated>) at com.clarestow.myproject.model.Certification.hashCode(Certification.java:102) at java.util.HashMap.put(Unknown Source) at java.util.HashSet.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:329) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:237) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195) at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865) at org.hibernate.loader.Loader.doQuery(Loader.java:729) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.loadCollection(Loader.java:1994) at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:411) at com.clarestow.myproject.model.MediaTitle.hashCode(MediaTitle.java:157) at java.util.HashMap.put(Unknown Source) at java.util.HashSet.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:329) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:237) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222) at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195) at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865) at org.hibernate.loader.Loader.doQuery(Loader.java:729) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.loadCollection(Loader.java:1994) at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163) at org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:211) at org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:200) at org.hibernate.engine.CascadingAction.getAllElementsIterator(CascadingAction.java:415) at org.hibernate.engine.CascadingAction.access$100(CascadingAction.java:27) at org.hibernate.engine.CascadingAction$1.getCascadableChildrenIterator(CascadingAction.java:125) at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:294) at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169) at org.hibernate.engine.Cascade.cascade(Cascade.java:130) at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBeforeDelete(DefaultDeleteEventListener.java:307) at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:246) at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:141) at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:52) at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:766) at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744) at org.springframework.orm.hibernate3.HibernateTemplate$25.doInHibernate(HibernateTemplate.java:790) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372) at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:784) at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:780) at org.appfuse.dao.hibernate.GenericDaoHibernate.remove(GenericDaoHibernate.java:88) at org.appfuse.service.impl.GenericManagerImpl.remove(GenericManagerImpl.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy27.remove(Unknown Source) at com.clarestow.myproject.webapp.action.MediaTypeAction.delete(MediaTypeAction.java:55) at com.clarestow.myproject.webapp.action.MediaTypeActionTest.testRemove(MediaTypeActionTest.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    AppFuse JIRA | 9 years ago | Mike Kelland
    org.hibernate.LazyInitializationException: illegal access to loading collection
  3. 0

    Hibernate, JPA - example manytomany with two tables

    Stack Overflow | 2 years ago | prilia
    org.hibernate.LazyInitializationException: illegal access to loading collection
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.hibernate.LazyInitializationException

    gilead | 8 years ago | romainn
    org.hibernate.LazyInitializationException: illegal access to loading collection
  6. 0

    illegal access to loading collection | JBoss Developer

    jboss.org | 7 months ago
    org.hibernate.LazyInitializationException: illegal access to loading collection

    1 unregistered visitors
    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. org.hibernate.LazyInitializationException

      illegal access to loading collection

      at org.hibernate.collection.AbstractPersistentCollection.initialize()
    2. Hibernate
      PersistentSet.hashCode
      1. org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
      2. org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
      3. org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:411)
      3 frames
    3. com.clarestow.myproject
      MediaIdentifier.hashCode
      1. com.clarestow.myproject.model.MediaIdentifier.hashCode(MediaIdentifier.java:78)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      4. java.lang.reflect.Method.invoke(Unknown Source)
      4 frames
    5. Hibernate
      CGLIBLazyInitializer.invoke
      1. org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
      1 frame
    6. com.clarestow.myproject
      TitleIdentifier.hashCode
      1. com.clarestow.myproject.model.MediaIdentifier$$EnhancerByCGLIB$$f7b21f30.hashCode(<generated>)
      2. com.clarestow.myproject.model.TitleIdentifier.hashCode(TitleIdentifier.java:89)
      2 frames
    7. Java RT
      AbstractCollection.addAll
      1. java.util.HashMap.put(Unknown Source)
      2. java.util.HashSet.add(Unknown Source)
      3. java.util.AbstractCollection.addAll(Unknown Source)
      3 frames
    8. Hibernate
      CollectionLoadContext.endLoadingCollections
      1. org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:329)
      2. org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:237)
      3. org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222)
      4. org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195)
      4 frames
    9. Hibernate
      AbstractCollectionPersister.initialize
      1. org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877)
      2. org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865)
      3. org.hibernate.loader.Loader.doQuery(Loader.java:729)
      4. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
      5. org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
      6. org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
      7. org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
      7 frames
    10. Hibernate
      PersistentSet.hashCode
      1. org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
      2. org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
      3. org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
      4. org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
      5. org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:411)
      5 frames
    11. com.clarestow.myproject
      MediaIdentifier.hashCode
      1. com.clarestow.myproject.model.MediaIdentifier.hashCode(MediaIdentifier.java:78)
      1 frame
    12. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      4. java.lang.reflect.Method.invoke(Unknown Source)
      4 frames
    13. Hibernate
      CGLIBLazyInitializer.invoke
      1. org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
      1 frame
    14. com.clarestow.myproject
      Marketplace.hashCode
      1. com.clarestow.myproject.model.MediaIdentifier$$EnhancerByCGLIB$$f7b21f30.hashCode(<generated>)
      2. com.clarestow.myproject.model.Marketplace.hashCode(Marketplace.java:154)
      2 frames
    15. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      4. java.lang.reflect.Method.invoke(Unknown Source)
      4 frames
    16. Hibernate
      CGLIBLazyInitializer.invoke
      1. org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
      1 frame
    17. com.clarestow.myproject
      Certification.hashCode
      1. com.clarestow.myproject.model.Marketplace$$EnhancerByCGLIB$$5dcfe0ce.hashCode(<generated>)
      2. com.clarestow.myproject.model.Certification.hashCode(Certification.java:102)
      2 frames
    18. Java RT
      AbstractCollection.addAll
      1. java.util.HashMap.put(Unknown Source)
      2. java.util.HashSet.add(Unknown Source)
      3. java.util.AbstractCollection.addAll(Unknown Source)
      3 frames
    19. Hibernate
      CollectionLoadContext.endLoadingCollections
      1. org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:329)
      2. org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:237)
      3. org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222)
      4. org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195)
      4 frames
    20. Hibernate
      AbstractCollectionPersister.initialize
      1. org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877)
      2. org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865)
      3. org.hibernate.loader.Loader.doQuery(Loader.java:729)
      4. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
      5. org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
      6. org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
      7. org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
      7 frames
    21. Hibernate
      PersistentSet.hashCode
      1. org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
      2. org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
      3. org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
      4. org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
      5. org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:411)
      5 frames
    22. com.clarestow.myproject
      MediaTitle.hashCode
      1. com.clarestow.myproject.model.MediaTitle.hashCode(MediaTitle.java:157)
      1 frame
    23. Java RT
      AbstractCollection.addAll
      1. java.util.HashMap.put(Unknown Source)
      2. java.util.HashSet.add(Unknown Source)
      3. java.util.AbstractCollection.addAll(Unknown Source)
      3 frames
    24. Hibernate
      CollectionLoadContext.endLoadingCollections
      1. org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:329)
      2. org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:237)
      3. org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222)
      4. org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195)
      4 frames
    25. Hibernate
      AbstractCollectionPersister.initialize
      1. org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877)
      2. org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865)
      3. org.hibernate.loader.Loader.doQuery(Loader.java:729)
      4. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
      5. org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
      6. org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
      7. org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
      7 frames
    26. Hibernate
      PersistentSet.iterator
      1. org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
      2. org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
      3. org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
      4. org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
      5. org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163)
      5 frames
    27. Hibernate
      Cascade.cascade
      1. org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:211)
      2. org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:200)
      3. org.hibernate.engine.CascadingAction.getAllElementsIterator(CascadingAction.java:415)
      4. org.hibernate.engine.CascadingAction.access$100(CascadingAction.java:27)
      5. org.hibernate.engine.CascadingAction$1.getCascadableChildrenIterator(CascadingAction.java:125)
      6. org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:294)
      7. org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
      8. org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
      9. org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
      10. org.hibernate.engine.Cascade.cascade(Cascade.java:130)
      10 frames
    28. Hibernate
      SessionImpl.delete
      1. org.hibernate.event.def.DefaultDeleteEventListener.cascadeBeforeDelete(DefaultDeleteEventListener.java:307)
      2. org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:246)
      3. org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:141)
      4. org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:52)
      5. org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:766)
      6. org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
      6 frames
    29. Hibernate
      HibernateTemplate.delete
      1. org.springframework.orm.hibernate3.HibernateTemplate$25.doInHibernate(HibernateTemplate.java:790)
      2. org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
      3. org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:784)
      4. org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:780)
      4 frames
    30. org.appfuse.dao
      GenericDaoHibernate.remove
      1. org.appfuse.dao.hibernate.GenericDaoHibernate.remove(GenericDaoHibernate.java:88)
      1 frame
    31. org.appfuse.service
      GenericManagerImpl.remove
      1. org.appfuse.service.impl.GenericManagerImpl.remove(GenericManagerImpl.java:96)
      1 frame
    32. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      4. java.lang.reflect.Method.invoke(Unknown Source)
      4 frames
    33. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
      3 frames
    34. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
      1 frame
    35. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames
    36. Unknown
      $Proxy27.remove
      1. $Proxy27.remove(Unknown Source)
      1 frame
    37. com.clarestow.myproject
      MediaTypeActionTest.testRemove
      1. com.clarestow.myproject.webapp.action.MediaTypeAction.delete(MediaTypeAction.java:55)
      2. com.clarestow.myproject.webapp.action.MediaTypeActionTest.testRemove(MediaTypeActionTest.java:69)
      2 frames
    38. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      4. java.lang.reflect.Method.invoke(Unknown Source)
      4 frames
    39. JUnit
      TestCase.runBare
      1. junit.framework.TestCase.runTest(TestCase.java:168)
      2. junit.framework.TestCase.runBare(TestCase.java:134)
      2 frames
    40. Spring TestContext
      ConditionalTestCase.runBare
      1. org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
      1 frame
    41. JUnit
      JUnit38ClassRunner.run
      1. junit.framework.TestResult$1.protect(TestResult.java:110)
      2. junit.framework.TestResult.runProtected(TestResult.java:128)
      3. junit.framework.TestResult.run(TestResult.java:113)
      4. junit.framework.TestCase.run(TestCase.java:124)
      5. junit.framework.TestSuite.runTest(TestSuite.java:232)
      6. junit.framework.TestSuite.run(TestSuite.java:227)
      7. org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
      7 frames
    42. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
      1 frame
    43. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      5 frames