Hibernate search doesn't work after add log4j

My application is Spring boot.The code almost follow Getting started with Hibernate Search - Hibernate Search

In gradle,
implementation (group: ‘org.hibernate’, name: ‘hibernate-search-orm’, version: ‘5.11.12.Final’)

Everything works, but after due to other module adds below, indexing stops to work.
implementation(group: ‘org.apache.logging.log4j’, name: ‘log4j-core’, version: “2.19.0”)
implementation(group: ‘org.apache.logging.log4j’, name: ‘log4j-api’, version: “2.19.0”)
implementation(group: ‘org.apache.logging.log4j’, name: ‘log4j-1.2-api’, version: “2.19.0”)

Got exception below
10:35:56.183 [Hibernate Search: entityloader-1] ERROR org.hibernate.search.exception.impl.LogErrorHandler - HSEARCH000058: HSEARCH000212: An exception occurred while the MassIndexer was transforming identifiers to Lucene Documents
org.hibernate.HibernateException: More than one row with the given identifier was found: 5764659, for class: com.wellsfargo.prime.rds.entity.rds.LegalEntityInvestorPod
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:104) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:66) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:2486) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:763) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.type.EntityType.resolve(EntityType.java:468) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.engine.internal.TwoPhaseLoad$EntityResolver.lambda$static$0(TwoPhaseLoad.java:576) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntityEntryLoadedState(TwoPhaseLoad.java:221) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:155) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:126) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1201) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.Loader.processResultSet(Loader.java:1009) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:967) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:357) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2868) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2850) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2682) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.Loader.list(Loader.java:2677) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1922) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:370) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
at org.hibernate.search.batchindexing.impl.IdentifierConsumerDocumentProducer.loadList(IdentifierConsumerDocumentProducer.java:174) ~[hibernate-search-orm-5.11.12.Final.jar:5.11.12.Final]
at org.hibernate.search.batchindexing.impl.IdentifierConsumerDocumentProducer.loadAllFromQueue(IdentifierConsumerDocumentProducer.java:140) ~[hibernate-search-orm-5.11.12.Final.jar:5.11.12.Final]
at org.hibernate.search.batchindexing.impl.IdentifierConsumerDocumentProducer.run(IdentifierConsumerDocumentProducer.java:120) ~[hibernate-search-orm-5.11.12.Final.jar:5.11.12.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
at java.lang.Thread.run(Thread.java:834) ~[?:?]

Anyone can help?

Hey there. :upside_down_face:
The error message you’re encountering suggests that there’s an issue with your Hibernate Search indexing, specifically related to a duplicate entity identifier in your database. Here are some steps you can follow to troubleshoot and resolve the issue:

  1. Check your database: Ensure that there are no duplicate records in your database table for the entity com.wellsfargo.prime.rds.entity.rds.LegalEntityInvestorPod with the identifier 5764659.
  2. Check your entity mapping: Review your entity mappings for the mentioned entity (LegalEntityInvestorPod) to make sure the unique identifier is properly defined. Ensure that you don’t have any unintentional duplicates in your mapping or database schema.
  3. Hibernate Search configuration: Verify your Hibernate Search configuration to make sure it’s correctly set up for indexing and doesn’t have any conflicting configurations.
  4. Log4j update: The addition of Log4j dependencies might not directly affect Hibernate Search indexing. However, if there were any logging changes, it’s essential to review your application’s logs for any other issues that could indirectly affect Hibernate Search.
  5. Gradle dependencies: Ensure that there are no dependency conflicts between Hibernate Search and Log4j that could lead to issues like indexing errors. Consider checking for dependency conflicts and update versions if necessary.

By thoroughly reviewing your database, entity mappings, Hibernate Search configuration, and dependencies, you should be able to identify and resolve the issue that’s causing the indexing problem.
Good luck