es 6.3.1版本与5.6.1版本之间有什么区别?spring boot集成6.3.1时为什么会报错而5.6.1不会?
匿名 | 发布于2018年09月01日 | 阅读数:4208
spring boot项目集成elasticsearch 6.3.1的时候,用maven package打包时会报如下错误:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'esTest': Unsatisfied dependency expressed through field 'client'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in class path resource [com/oo_1010/demo/elasticsearch/EsConfig.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method 'client' threw exception;
nested exception is java.lang.NoClassDefFoundError: org/elasticsearch/script/ScriptEngine
这是我的配置文件pom.xml对es的配置:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>6.3.1</version>
</dependency>
而当我把上面配置文件es的版本换为5.6.1时,maven打包不再报错,打包的jar报在命令行下用java -jar命令也能正常地跑起来了
这两个版本之间有什么区别吗
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'esTest': Unsatisfied dependency expressed through field 'client'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in class path resource [com/oo_1010/demo/elasticsearch/EsConfig.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method 'client' threw exception;
nested exception is java.lang.NoClassDefFoundError: org/elasticsearch/script/ScriptEngine
这是我的配置文件pom.xml对es的配置:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>6.3.1</version>
</dependency>
而当我把上面配置文件es的版本换为5.6.1时,maven打包不再报错,打包的jar报在命令行下用java -jar命令也能正常地跑起来了
这两个版本之间有什么区别吗
1 个回复
王庆焕 - https://discuss.elastic.co/u/wangqinghuan/
赞同来自: MR_Gordon