我正在尝试将 Jest 0.0.6 ElasticSearch 客户端与 SpringBoot 1.4 一起使用,并出现以下错误。我认为这是因为 SpringBoot 尝试自动创建一个 Jest 客户端以及对其进行健康检查,但是旧的 Jest 客户端没有一些必需的类。
任何想法如何解决这个问题?
我需要连接到旧的 ElasticSearch v0.90.5 服务器,目前我无法升级。如果您对如何最好地从 SpringBoot 连接到这样的旧版本有任何想法,那也将非常有帮助。
Caused by:org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'metricsEndpointMetricReader' defined in class path resource
...
[org/springframework/boot/actuate/autoconfigure/ElasticsearchHealthIndicatorConfiguration$ElasticsearchJestHealthIndicatorConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthIndicator]:
Factory method 'elasticsearchHealthIndicator' threw exception; nested exception is java.lang.NoClassDefFoundError: io/searchbox/action/Action; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration ': Bean instantiation via constructor failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration$$EnhancerBySpringCGLIB$$909d8b5d]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'elasticsearchHealthIndicator' defined in class path resource [org/springframework/boot/actuate/autoconfigure/ElasticsearchHealthIndicatorConfiguration$ElasticsearchJestHealthIndicatorConfiguration.class]: Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthIndicator]: Factory method 'elasticsearchHealthIndicator' threw exception; nested exception is java.lang.NoClassDefFoundError: io/searchbox/action/Action
来自 Spring Boot 1.4 发行说明:
"开玩笑的支持
如果 Jest 在类路径上,Spring Boot 会自动配置一个 JestClient 和一个专用的 HealthIndicator。即使 spring-data-elasticsearch 不在类路径中,这也允许您使用 Elasticsearch。”