org.hibernate.search.bridge.BridgeException: Exception while calling bridge#set class: de.juplo.allbridge.test.b.Foo path: bar

Hibernate JIRA | Kai Moritz | 4 years ago
  1. 0

    [HSEARCH-1260] LazyInitializationException while indexing - Hibernate JIRA

    atlassian.net | 1 year ago
    org.hibernate.search.bridge.BridgeException: Exception while calling bridge#set class: de.juplo.allbridge.test.b.Foo path: bar
  2. 0

    I am not sure, if you consider this as a bug or as invalid usage. But in my view (the view of a user) it is clearly a bug. I have implemented a custom bridge, that collects all fields of associated classes, that are named "ALL". The goal is, to create an all-field, that spans the parent-class and all its associated classes. The custom bridge works fine for all "normal" fields of the parent class and the first associated class. But if the associated class contains another associated class, a LazyInitializationException is raised, when indexing with MassIndexer.startAndWait(): {noformat} HSEARCH000116: Unexpected error during MassIndexer operation org.hibernate.search.bridge.BridgeException: Exception while calling bridge#set class: de.juplo.allbridge.test.b.Foo path: bar at org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper.buildBridgeException(ContextualExceptionBridgeHelper.java:97) at org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper$OneWayConversionContextImpl.set(ContextualExceptionBridgeHelper.java:126) at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:533) at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.getDocument(DocumentBuilderIndexedEntity.java:478) at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.createAddWork(DocumentBuilderIndexedEntity.java:401) at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.index(EntityConsumerLuceneWorkProducer.java:172) at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.indexAllQueue(EntityConsumerLuceneWorkProducer.java:132) at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.run(EntityConsumerLuceneWorkProducer.java:102) at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:112) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:679) Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: de.juplo.allbridge.test.b.Bar.foobars, no session or session was closed at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:393) at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:385) at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:378) at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:112) at org.hibernate.collection.internal.PersistentSet.toString(PersistentSet.java:326) at de.juplo.allbridge.AllBridge.handleField(AllBridge.java:185) at de.juplo.allbridge.AllBridge.recursion(AllBridge.java:106) at de.juplo.allbridge.AllBridge.set(AllBridge.java:65) at org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper$OneWayConversionContextImpl.set(ContextualExceptionBridgeHelper.java:123) ... 10 more {noformat} I suspect, that the Exception might also be thrown, when indexing an not fully initalized entity asynchronously. Nevertheless, the little project in the attachement calls {{MassIndexer.startAndWait()}} to demonstrate the issue. This bug might be related to https://hibernate.onjira.com/browse/HSEARCH-689

    Hibernate JIRA | 4 years ago | Kai Moritz
    org.hibernate.search.bridge.BridgeException: Exception while calling bridge#set class: de.juplo.allbridge.test.b.Foo path: bar
  3. 0

    I am not sure, if you consider this as a bug or as invalid usage. But in my view (the view of a user) it is clearly a bug. I have implemented a custom bridge, that collects all fields of associated classes, that are named "ALL". The goal is, to create an all-field, that spans the parent-class and all its associated classes. The custom bridge works fine for all "normal" fields of the parent class and the first associated class. But if the associated class contains another associated class, a LazyInitializationException is raised, when indexing with MassIndexer.startAndWait(): {noformat} HSEARCH000116: Unexpected error during MassIndexer operation org.hibernate.search.bridge.BridgeException: Exception while calling bridge#set class: de.juplo.allbridge.test.b.Foo path: bar at org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper.buildBridgeException(ContextualExceptionBridgeHelper.java:97) at org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper$OneWayConversionContextImpl.set(ContextualExceptionBridgeHelper.java:126) at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:533) at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.getDocument(DocumentBuilderIndexedEntity.java:478) at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.createAddWork(DocumentBuilderIndexedEntity.java:401) at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.index(EntityConsumerLuceneWorkProducer.java:172) at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.indexAllQueue(EntityConsumerLuceneWorkProducer.java:132) at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.run(EntityConsumerLuceneWorkProducer.java:102) at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:112) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:679) Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: de.juplo.allbridge.test.b.Bar.foobars, no session or session was closed at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:393) at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:385) at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:378) at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:112) at org.hibernate.collection.internal.PersistentSet.toString(PersistentSet.java:326) at de.juplo.allbridge.AllBridge.handleField(AllBridge.java:185) at de.juplo.allbridge.AllBridge.recursion(AllBridge.java:106) at de.juplo.allbridge.AllBridge.set(AllBridge.java:65) at org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper$OneWayConversionContextImpl.set(ContextualExceptionBridgeHelper.java:123) ... 10 more {noformat} I suspect, that the Exception might also be thrown, when indexing an not fully initalized entity asynchronously. Nevertheless, the little project in the attachement calls {{MassIndexer.startAndWait()}} to demonstrate the issue. This bug might be related to https://hibernate.onjira.com/browse/HSEARCH-689

    Hibernate JIRA | 4 years ago | Kai Moritz
    org.hibernate.search.bridge.BridgeException: Exception while calling bridge#set class: de.juplo.allbridge.test.b.Foo path: bar
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Error on HQL query with parameter

    Stack Overflow | 4 years ago | Mike HT
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: edu.univ.mht.domain.Course.students, no session or session was closed
  6. 0

    JPA CascadeType.REFRESH not working?

    Stack Overflow | 6 years ago | RRR_J
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: LineEquipmentFormat.lineEquipmentFormatDivisions, no session or session was closed

  1. tjago 1 times, last 9 months ago
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

    failed to lazily initialize a collection of role: de.juplo.allbridge.test.b.Bar.foobars, no session or session was closed

    at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException()
  2. Hibernate
    PersistentSet.toString
    1. org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:393)
    2. org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:385)
    3. org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:378)
    4. org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:112)
    5. org.hibernate.collection.internal.PersistentSet.toString(PersistentSet.java:326)
    5 frames
  3. de.juplo.allbridge
    AllBridge.set
    1. de.juplo.allbridge.AllBridge.handleField(AllBridge.java:185)
    2. de.juplo.allbridge.AllBridge.recursion(AllBridge.java:106)
    3. de.juplo.allbridge.AllBridge.set(AllBridge.java:65)
    3 frames
  4. Hibernate Search Engine
    OptionallyWrapInJTATransaction.run
    1. org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper$OneWayConversionContextImpl.set(ContextualExceptionBridgeHelper.java:123)
    2. org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:533)
    3. org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.getDocument(DocumentBuilderIndexedEntity.java:478)
    4. org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.createAddWork(DocumentBuilderIndexedEntity.java:401)
    5. org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.index(EntityConsumerLuceneWorkProducer.java:172)
    6. org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.indexAllQueue(EntityConsumerLuceneWorkProducer.java:132)
    7. org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.run(EntityConsumerLuceneWorkProducer.java:102)
    8. org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:112)
    8 frames
  5. Java RT
    Thread.run
    1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    3. java.lang.Thread.run(Thread.java:679)
    3 frames