【问题标题】:Hibernate-Search 6 and Elasticsearch integrationHibernate-Search 6 和 Elasticsearch 集成
【发布时间】:2020-03-07 19:16:11
【问题描述】:

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

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

我查看了谷歌,似乎我是世界上第一个面临这个问题的人。

***************************
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

知道如何解决它吗?,在我的应用程序中,我正在使用 Spring boot 和 jpa。

【问题讨论】:

    标签: elasticsearch hibernate-search


    【解决方案1】:

    here in the documentation 所示,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,所以这可能就是您正在使用的。

    最好的做法是升级到 Hibernate ORM 5.4 附带的 Spring Boot 2.2.1.RELEASE。

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

    只需在您的 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 测试的版本通常更安全。

    【讨论】:

    • 谢谢它对我有用,你知道在 Hibernate Search 6 中是否有类似于“@IndexedEmbedded(includeEmbeddedObjectId = true)”的东西,这条指令来自 HS5,但在 HS6 中不存在。
    • @alexcornejo 还没有,没有:hibernate.atlassian.net/browse/HSEARCH-3071。您可以通过使用 @GenericField 注释嵌入类的 ID 来获得类似的行为。
    猜你喜欢
    • 2022-07-29
    • 1970-01-01
    • 1970-01-01
    • 2015-08-17
    • 2017-11-09
    • 2018-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多