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
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    [HSEARCH-1260] LazyInitializationException while indexing - Hibernate JIRA

    atlassian.net | 2 years 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

    org.hibernate.LazyInitializationException in Hosted

    https://bugzilla.redhat.com/bugzilla/ | 1 decade ago | Bret McMillan
    org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java(Compiled Code)) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java(Inlined Compiled Code)) at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java(Compiled Code)) at com.redhat.rhn.domain.org.OrgImpl$$EnhancerByCGLIB$$a7f782b6.isPayingCustomer(<generated>(Compiled Code)) at com.redhat.rhn.manager.errata.cache.UpdateErrataCacheCommand.processServer(UpdateErrataCacheCommand.java(Compiled Code)) at com.redhat.rhn.manager.errata.cache.UpdateErrataCacheCommand.updateErrataCache(UpdateErrataCacheCommand.java(Compiled Code)) at com.redhat.rhn.frontend.events.UpdateErrataCacheAction.execute(UpdateErrataCacheAction.java(Compiled Code)) at com.redhat.rhn.common.messaging.ActionExecutor.run(ActionExecutor.java(Compiled Code)) at com.redhat.rhn.common.messaging.MessageDispatcher.run(MessageDispatcher.java(Compiled Code))

  1. tjago 1 times, last 1 year ago
1 unregistered visitors

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