相关文章推荐
狂野的荒野  ·  Caused by: ...·  3 周前    · 
打篮球的骆驼  ·  爬楼梯和跑步哪个燃脂效果更好?真相是这样的_ ...·  8 月前    · 
严肃的钱包  ·  学术资源不定期分享-【费曼物理学讲义英文原版 ...·  1 年前    · 
年轻有为的滑板  ·  丧偶皇后漫画完整版免费阅读-丧偶皇后漫画下拉 ...·  1 年前    · 
无邪的铁板烧  ·  “最令我心动的还是中国”——访萨尔瓦多驻华大 ...·  1 年前    · 
乖乖的香菜  ·  2023年3月份宝马iX3销量3864台, ...·  1 年前    · 
Code  ›  Spring Boot导致ElasticSearch版本冲突开发者社区
elasticsearch
https://cloud.tencent.com/developer/article/1418127
可爱的酱肘子
1 年前
作者头像
十毛
0 篇文章

Spring Boot导致ElasticSearch版本冲突

前往专栏
腾讯云
备案 控制台
开发者社区
学习
实践
活动
专区
工具
TVP
文章/答案/技术大牛
写文章
社区首页 > 专栏 > 用户1337634的专栏 > 正文

Spring Boot导致ElasticSearch版本冲突

发布 于 2019-04-25 11:37:09
3.3K 0
举报

使用Spring Boot新版后,ElasticSearch出现如下错误

Cannot register setting [http.netty.max_composite_buffer_components] twice

Caused by: java.lang.IllegalArgumentException: Cannot register setting [http.netty.max_composite_buffer_components] twice
    at org.elasticsearch.common.settings.SettingsModule.registerSetting(SettingsModule.java:172) ~[elasticsearch-5.6.16.jar:5.6.16]
    at org.elasticsearch.common.settings.SettingsModule.<init>(SettingsModule.java:74) ~[elasticsearch-5.6.16.jar:5.6.16]
    at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:141) ~[elasticsearch-5.6.16.jar:5.6.16]
    at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:268) ~[elasticsearch-5.6.16.jar:5.6.16]
    at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:133) ~[transport-5.6.16.jar:5.6.16]
    at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:119) ~[transport-5.6.16.jar:5.6.16]
    at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:109) ~[transport-5.6.16.jar:5.6.16]

原因

因为transport使用的是 5.5.3 版本,对应的 transport-netty3-client 也是 5.5.3 ,但是 transport-netty4-client 却被Spring Boot设置为 6.4.3

版本冲突

解决办法

transport-netty4-client也设置为 5.5.3

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>5.5.3</version>
</dependency>
<dependency>
    <groupId>org.elasticsearch.plugin</groupId>
    <artifactId>transport-netty4-client</artifactId>
    <version>5.5.3</version>
</dependency>
<dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>transport</artifactId>
    <version>5.5.3</version>
    <exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>transport-netty4-client</artifactId>
        </exclusion>
    </exclusions>
</dependency>

版本不兼容原因分析

在两个版本中,Netty3Plugin和Netty4Plugin都会去设置属性 http.netty.max_composite_buffer_components ,但是区别在于5.5.3中,这个属性是共享的 Property.Shared ,但是在6.4.3中该属性不是共享(其实共享的本意我还没有弄得很清楚)

  • 5.5.3 {Property.NodeScope, Property.Shared}
SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS = Setting.intSetting("http.netty.max_composite_buffer_components", -1, new Property[]{Property.NodeScope, Property.Shared});
  • 6.4.3 Property.NodeScope
public static Setting<Integer> SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS =
 
推荐文章
狂野的荒野  ·  Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no furthe
3 周前
打篮球的骆驼  ·  爬楼梯和跑步哪个燃脂效果更好?真相是这样的_腾讯新闻
8 月前
严肃的钱包  ·  学术资源不定期分享-【费曼物理学讲义英文原版】_费曼物理学讲义pdf百度网盘-CSDN博客
1 年前
年轻有为的滑板  ·  丧偶皇后漫画完整版免费阅读-丧偶皇后漫画下拉式免费阅读-爱奇艺漫画作品-漫画牛
1 年前
无邪的铁板烧  ·  “最令我心动的还是中国”——访萨尔瓦多驻华大使阿尔多·阿尔瓦雷斯
1 年前
乖乖的香菜  ·  2023年3月份宝马iX3销量3864台, 同比增长42.9%_销量数据 - 车主之家
1 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
Code - 代码工具平台
© 2024 ~ 沪ICP备11025650号