Hibernate-Search 6 and Elasticsearch integration



我正在Hibernate Search应用程序中工作,我正在尝试使用版本6(目前处于测试版(。我遵循了中的所有说明和文档https://docs.jboss.org/hibernate/search/6.0/reference/en-US/html_single/#getting-已启动配置

在尝试启动我的应用程序后,我得到了下一个错误:

我在谷歌上搜索过,似乎我是世界上第一个面临这个问题的人。

***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmIndexedTypeContext.<init>(HibernateOrmIndexedTypeContext.java:35)
The following method did not exist:
org.hibernate.metamodel.spi.MetamodelImplementor.entity(Ljava/lang/Class;)Lorg/hibernate/metamodel/model/domain/spi/EntityTypeDescriptor;
It was loaded from the following location:
file:/home/myUser/.m2/repository/org/hibernate/hibernate-core/5.3.11.Final/hibernate-core-5.3.11.Final.jar

Action:
Correct the classpath of your application so that it contains a single, compatible version of org.hibernate.metamodel.spi.MetamodelImplementor

知道怎么解决吗?,在我的应用程序中,我使用的是Springboot和jpa。

如文档中所示,Hibernate Search 6.0.0.Beta2需要Hibernate ORM 5.4.7.Final或更高版本。您正在使用Hibernate ORM 5.3.11 Final.

我认为Spring Boot 2.1附带了ORM 5.3,所以这可能就是你正在使用的。

最好的做法是升级到Spring Boot 2.2.1.RELEASE,它与Hibernate ORM 5.4一起提供。

如果这不可能,您仍然可以使用Spring Boot 2.1,并直接在您的POM中覆盖Hibernate ORM版本:据我所见,它在Spring Boot中运行得相当好。

只需在POM:中设置此属性

<properties>
<!-- Override the version of Hibernate ORM in Spring Boot -->
<hibernate.version>5.4.7.Final</hibernate.version>
</properties>

请注意,从技术上讲,Hibernate ORM 5.4.4.Final之后的任何版本都应该有效,但坚持使用Hibernate Search测试过的版本通常更安全。

最新更新