java.lang.IllegalStateException: Failed to introspect Class

后端 未结 2 1910
难免孤独
难免孤独 2021-01-04 07:56

I am trying to add Elasticsearch to my project. I have affffded the necessary dependencies to my pom.xml file. When I run the server I am getting this error:

2条回答
  •  心在旅途
    2021-01-04 08:59

    Caused by: java.lang.ClassNotFoundException: org.springframework.data.elasticsearch.core.ElasticsearchOperations

    This error message means that the jar containing this class is not on the application classpath.

    Add spring-data-elasticsearch jar to it, and your error should be gone.

    if you are using maven, add the jar to the classpath this way :

    
        org.springframework.data
        spring-data-elasticsearch
        3.2.5.RELEASE
    
    

    The version that you should use depends on the version of elastic search you are connecting to :

    +--------------+----------------------------+----------------+-------------+
    | Spring Data  | Spring Data Elasticsearch  | Elasticsearch  | Spring Boot |
    +--------------+----------------------------+----------------+-------------+
    | 2020.0.0     | 4.1.x                      |          7.9.3 | 2.3.x       |
    | Neumann      | 4.0.x                      |          7.6.2 | 2.3.x       |
    | Moore        | 3.2.x                      |          6.8.4 | 2.2.x       |
    | Lovelace     | 3.1.x                      |          6.2.2 | 2.1.x       |
    | Kay          | 3.0.x                      |          5.5.0 | 2.0.x       |
    | Ingalls      | 2.1.x                      |          2.4.0 | 1.5.x       |
    +--------------+----------------------------+----------------+-------------+
    

    (source : https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#preface.versions )

提交回复
热议问题