The maven package introduces the problem ClassNotFoundException: org.elasticsearch.client.Cancellable

The maven package introduces the problem ClassNotFoundException: org.elasticsearch.client.Cancellable

For business needs, do search function. Under the springboot aggregation project, a new es module module was created, but when the elasticsearchdependency was introduced , there was a problem

After introducing the corresponding dependencies

    <dependency>
      <groupId>org.elasticsearch</groupId>
      <artifactId>elasticsearch</artifactId>
      <version>7.6.0</version>
    </dependency>
    <dependency>
      <groupId>org.elasticsearch.client</groupId>
      <artifactId>elasticsearch-rest-high-level-client</artifactId>
      <version>7.6.0</version>
    </dependency>

I keep reporting errors during startup, but it doesn’t make sense. After that 7.6.0, I don’t understand why the introduction is obviously why there is an error 6.4.3. It’s strange.

Later spring-boot-dependencies, it was found in the file that the version declaration was originally made under the spring-boot-dependencies label

The solution is to overwrite the version number in the corresponding module pom.xml

ok, the problem is solved, because the latest version of elasticsearch is currently 7.6.0. As a coder that doesn't use the old, naturally, it is necessary to introduce the latest ones. Naturally, the pits have to be stepped on.

Reference: https://cloud.tencent.com/developer/article/1595362 maven package introduction problem ClassNotFoundException: org.elasticsearch.client.Cancellable-Cloud + Community-Tencent Cloud