org.hibernate.HibernateException: Error while indexing in Hibernate Search (before transaction completion)

Hibernate JIRA | Elmer van Chastelet | 5 years ago
  1. 0

    When I have an @IndexedEmbedded field with the targetElement set to a subclass of the embedded type (at least the case for a collection), indexing goes wrong. After seeing this behavior in my own app, I extended src/test/java/org/hibernate/search/test/embedded/AbstractProduct to have a pricingFeatures field: {code:java} @ManyToMany(mappedBy="product", cascade=CascadeType.ALL) //just to make the test easier, cascade doesn't really make any business sense @IndexedEmbedded(targetElement=PricingFeature.class) private Set<ProductFeature> pricingFeatures = new HashSet<ProductFeature>(); {code} Added PricingFeature class: {code:java} package org.hibernate.search.test.embedded; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Index; public class PricingFeature extends ProductFeature { @Field(index= Index.UN_TOKENIZED) private String price; public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } } {code} The test itself {{org.hibernate.search.test.embedded.EmbeddedTest}} is untouched, and {{testEmbeddedToManyInSuperslass}} fails with the following exception: {code} EmbeddedTest org.hibernate.search.test.embedded.EmbeddedTest testEmbeddedToManyInSuperslass(org.hibernate.search.test.embedded.EmbeddedTest) org.hibernate.HibernateException: Error while indexing in Hibernate Search (before transaction completion) at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnBeforeTx.doBeforeTransactionCompletion(EventSourceTransactionContext.java:175) at org.hibernate.engine.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:554) at org.hibernate.engine.ActionQueue.beforeTransactionCompletion(ActionQueue.java:216) at org.hibernate.impl.SessionImpl.beforeTransactionCompletion(SessionImpl.java:571) at org.hibernate.jdbc.JDBCContext.beforeTransactionCompletion(JDBCContext.java:250) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:138) at org.hibernate.search.test.embedded.EmbeddedTest.testEmbeddedToManyInSuperslass(EmbeddedTest.java:368) 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:616) at junit.framework.TestCase.runTest(TestCase.java:168) at org.hibernate.testing.junit.functional.annotations.HibernateTestCase.runTest(HibernateTestCase.java:97) at org.hibernate.testing.junit.functional.annotations.HibernateTestCase.runBare(HibernateTestCase.java:85) 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:243) at junit.framework.TestSuite.run(TestSuite.java:238) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.IllegalStateException: Could not get property value at org.hibernate.search.util.ReflectionHelper.getMemberValue(ReflectionHelper.java:94) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:477) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:526) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.getDocument(DocumentBuilderIndexedEntity.java:443) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.createAddWork(DocumentBuilderIndexedEntity.java:380) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.addWorkToQueue(DocumentBuilderIndexedEntity.java:358) at org.hibernate.search.engine.WorkPlan$PerEntityWork.enqueueLuceneWork(WorkPlan.java:456) at org.hibernate.search.engine.WorkPlan$PerClassWork.enqueueLuceneWork(WorkPlan.java:257) at org.hibernate.search.engine.WorkPlan.getPlannedLuceneWork(WorkPlan.java:150) at org.hibernate.search.backend.WorkQueue.prepareWorkPlan(WorkQueue.java:134) at org.hibernate.search.backend.impl.BatchedQueueingProcessor.prepareWorks(BatchedQueueingProcessor.java:124) at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.beforeCompletion(PostTransactionWorkQueueSynchronization.java:89) at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnBeforeTx.doBeforeTransactionCompletion(EventSourceTransactionContext.java:172) ... 26 more Caused by: java.lang.IllegalArgumentException: Invoking price with wrong parameters at org.hibernate.annotations.common.reflection.java.JavaXProperty.invoke(JavaXProperty.java:84) at org.hibernate.search.util.ReflectionHelper.getMemberValue(ReflectionHelper.java:91) ... 38 more Caused by: java.lang.IllegalArgumentException: Can not set java.lang.String field org.hibernate.search.test.embedded.PricingFeature.price to org.hibernate.search.test.embedded.ProductFeature at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168) at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:55) at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36) at java.lang.reflect.Field.get(Field.java:376) at org.hibernate.annotations.common.reflection.java.JavaXProperty.invoke(JavaXProperty.java:77) ... 39 more {code} This is probably also applicable for HSearch 4.1.0, but untested.

    Hibernate JIRA | 5 years ago | Elmer van Chastelet
    org.hibernate.HibernateException: Error while indexing in Hibernate Search (before transaction completion)
  2. 0

    When I have an @IndexedEmbedded field with the targetElement set to a subclass of the embedded type (at least the case for a collection), indexing goes wrong. After seeing this behavior in my own app, I extended src/test/java/org/hibernate/search/test/embedded/AbstractProduct to have a pricingFeatures field: {code:java} @ManyToMany(mappedBy="product", cascade=CascadeType.ALL) //just to make the test easier, cascade doesn't really make any business sense @IndexedEmbedded(targetElement=PricingFeature.class) private Set<ProductFeature> pricingFeatures = new HashSet<ProductFeature>(); {code} Added PricingFeature class: {code:java} package org.hibernate.search.test.embedded; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Index; public class PricingFeature extends ProductFeature { @Field(index= Index.UN_TOKENIZED) private String price; public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } } {code} The test itself {{org.hibernate.search.test.embedded.EmbeddedTest}} is untouched, and {{testEmbeddedToManyInSuperslass}} fails with the following exception: {code} EmbeddedTest org.hibernate.search.test.embedded.EmbeddedTest testEmbeddedToManyInSuperslass(org.hibernate.search.test.embedded.EmbeddedTest) org.hibernate.HibernateException: Error while indexing in Hibernate Search (before transaction completion) at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnBeforeTx.doBeforeTransactionCompletion(EventSourceTransactionContext.java:175) at org.hibernate.engine.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:554) at org.hibernate.engine.ActionQueue.beforeTransactionCompletion(ActionQueue.java:216) at org.hibernate.impl.SessionImpl.beforeTransactionCompletion(SessionImpl.java:571) at org.hibernate.jdbc.JDBCContext.beforeTransactionCompletion(JDBCContext.java:250) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:138) at org.hibernate.search.test.embedded.EmbeddedTest.testEmbeddedToManyInSuperslass(EmbeddedTest.java:368) 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:616) at junit.framework.TestCase.runTest(TestCase.java:168) at org.hibernate.testing.junit.functional.annotations.HibernateTestCase.runTest(HibernateTestCase.java:97) at org.hibernate.testing.junit.functional.annotations.HibernateTestCase.runBare(HibernateTestCase.java:85) 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:243) at junit.framework.TestSuite.run(TestSuite.java:238) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.IllegalStateException: Could not get property value at org.hibernate.search.util.ReflectionHelper.getMemberValue(ReflectionHelper.java:94) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:477) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:526) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.getDocument(DocumentBuilderIndexedEntity.java:443) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.createAddWork(DocumentBuilderIndexedEntity.java:380) at org.hibernate.search.engine.DocumentBuilderIndexedEntity.addWorkToQueue(DocumentBuilderIndexedEntity.java:358) at org.hibernate.search.engine.WorkPlan$PerEntityWork.enqueueLuceneWork(WorkPlan.java:456) at org.hibernate.search.engine.WorkPlan$PerClassWork.enqueueLuceneWork(WorkPlan.java:257) at org.hibernate.search.engine.WorkPlan.getPlannedLuceneWork(WorkPlan.java:150) at org.hibernate.search.backend.WorkQueue.prepareWorkPlan(WorkQueue.java:134) at org.hibernate.search.backend.impl.BatchedQueueingProcessor.prepareWorks(BatchedQueueingProcessor.java:124) at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.beforeCompletion(PostTransactionWorkQueueSynchronization.java:89) at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnBeforeTx.doBeforeTransactionCompletion(EventSourceTransactionContext.java:172) ... 26 more Caused by: java.lang.IllegalArgumentException: Invoking price with wrong parameters at org.hibernate.annotations.common.reflection.java.JavaXProperty.invoke(JavaXProperty.java:84) at org.hibernate.search.util.ReflectionHelper.getMemberValue(ReflectionHelper.java:91) ... 38 more Caused by: java.lang.IllegalArgumentException: Can not set java.lang.String field org.hibernate.search.test.embedded.PricingFeature.price to org.hibernate.search.test.embedded.ProductFeature at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168) at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:55) at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36) at java.lang.reflect.Field.get(Field.java:376) at org.hibernate.annotations.common.reflection.java.JavaXProperty.invoke(JavaXProperty.java:77) ... 39 more {code} This is probably also applicable for HSearch 4.1.0, but untested.

    Hibernate JIRA | 5 years ago | Elmer van Chastelet
    org.hibernate.HibernateException: Error while indexing in Hibernate Search (before transaction completion)
  3. 0

    Hibernate and JPA: Could not get a field value by reflection getter

    Stack Overflow | 4 years ago | lordmj
    java.lang.RuntimeException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.enetexperience.zeusportal.sql.graph.SQLGraphObject.actions
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Java lang illegalargumentexception uri scheme is not file - Java Programming - KnowCoding.com

    knowcoding.com | 1 year ago
    java.lang.RuntimeException: java.lang.IllegalArgumentException: Can not set java.lang.Object field Container.bag to java.lang.String
  6. 0

    Java lang runtimeexception expected an externsheet record but got org apache poi hs - Java Programming - KnowCoding.com

    knowcoding.com | 8 months ago
    java.lang.RuntimeException: java.lang.IllegalArgumentException: Can not set java.lang.Object field Container.bag to java.lang.String

    20 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. java.lang.IllegalArgumentException

      Can not set java.lang.String field org.hibernate.search.test.embedded.PricingFeature.price to org.hibernate.search.test.embedded.ProductFeature

      at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException()
    2. Java RT
      Field.get
      1. sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164)
      2. sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168)
      3. sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:55)
      4. sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)
      5. java.lang.reflect.Field.get(Field.java:376)
      5 frames
    3. Hibernate Commons Annotations
      JavaXProperty.invoke
      1. org.hibernate.annotations.common.reflection.java.JavaXProperty.invoke(JavaXProperty.java:77)
      1 frame
    4. Hibernate Search Engine
      EventSourceTransactionContext$DelegateToSynchronizationOnBeforeTx.doBeforeTransactionCompletion
      1. org.hibernate.search.util.ReflectionHelper.getMemberValue(ReflectionHelper.java:91)
      2. org.hibernate.search.engine.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:477)
      3. org.hibernate.search.engine.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:526)
      4. org.hibernate.search.engine.DocumentBuilderIndexedEntity.getDocument(DocumentBuilderIndexedEntity.java:443)
      5. org.hibernate.search.engine.DocumentBuilderIndexedEntity.createAddWork(DocumentBuilderIndexedEntity.java:380)
      6. org.hibernate.search.engine.DocumentBuilderIndexedEntity.addWorkToQueue(DocumentBuilderIndexedEntity.java:358)
      7. org.hibernate.search.engine.WorkPlan$PerEntityWork.enqueueLuceneWork(WorkPlan.java:456)
      8. org.hibernate.search.engine.WorkPlan$PerClassWork.enqueueLuceneWork(WorkPlan.java:257)
      9. org.hibernate.search.engine.WorkPlan.getPlannedLuceneWork(WorkPlan.java:150)
      10. org.hibernate.search.backend.WorkQueue.prepareWorkPlan(WorkQueue.java:134)
      11. org.hibernate.search.backend.impl.BatchedQueueingProcessor.prepareWorks(BatchedQueueingProcessor.java:124)
      12. org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.beforeCompletion(PostTransactionWorkQueueSynchronization.java:89)
      13. org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnBeforeTx.doBeforeTransactionCompletion(EventSourceTransactionContext.java:172)
      13 frames
    5. Hibernate
      ActionQueue.beforeTransactionCompletion
      1. org.hibernate.engine.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:554)
      2. org.hibernate.engine.ActionQueue.beforeTransactionCompletion(ActionQueue.java:216)
      2 frames
    6. Hibernate
      SessionImpl.beforeTransactionCompletion
      1. org.hibernate.impl.SessionImpl.beforeTransactionCompletion(SessionImpl.java:571)
      1 frame
    7. Hibernate
      JDBCTransaction.commit
      1. org.hibernate.jdbc.JDBCContext.beforeTransactionCompletion(JDBCContext.java:250)
      2. org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:138)
      2 frames
    8. org.hibernate.search
      EmbeddedTest.testEmbeddedToManyInSuperslass
      1. org.hibernate.search.test.embedded.EmbeddedTest.testEmbeddedToManyInSuperslass(EmbeddedTest.java:368)
      1 frame
    9. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:616)
      4 frames
    10. JUnit
      TestCase.runTest
      1. junit.framework.TestCase.runTest(TestCase.java:168)
      1 frame
    11. org.hibernate.testing
      HibernateTestCase.runBare
      1. org.hibernate.testing.junit.functional.annotations.HibernateTestCase.runTest(HibernateTestCase.java:97)
      2. org.hibernate.testing.junit.functional.annotations.HibernateTestCase.runBare(HibernateTestCase.java:85)
      2 frames
    12. 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:243)
      6. junit.framework.TestSuite.run(TestSuite.java:238)
      7. org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
      7 frames
    13. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      1 frame
    14. 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:467)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      5 frames