org.hibernate.LazyInitializationException

failed to lazily initialize a collection of role: org.dspace.content.DSpaceObject.handles, could not initialize proxy - no Session

Samebug tips2

tip

Use eager fetch (fetch = FetchType.EAGER) annotation.

tip

Use the proper ORM annotations (@ManyToOne and @OneToMany).

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web141

  • via by Terry Brady,
  • Stack trace

    • org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.dspace.content.DSpaceObject.handles, could not initialize proxy - no Session at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:569) at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:188) at org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:139) at org.hibernate.collection.internal.PersistentBag.isEmpty(PersistentBag.java:249) at org.apache.commons.collections.CollectionUtils.isEmpty(CollectionUtils.java:979) at org.apache.commons.collections.CollectionUtils.isNotEmpty(CollectionUtils.java:992) at org.dspace.content.DSpaceObject.getHandle(DSpaceObject.java:133) at org.dspace.discovery.SolrServiceImpl.indexContent(SolrServiceImpl.java:198) at org.dspace.discovery.SolrServiceImpl.indexContent(SolrServiceImpl.java:2305) at org.dspace.discovery.IndexClient.indexAll(IndexClient.java:192) at org.dspace.discovery.IndexClient.main(IndexClient.java:152) 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.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:229) at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:81)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    serious2monkeysserious2monkeys
    6 times, last one,
    MoYaproMoYapro
    6 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    38 more bugmates