elasticsearch5.11创建client报错

sexants 发布于 2016/12/16 17:33
阅读 2K+
收藏 0

按照文档创建client

TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300))
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host2"), 9300));
报错

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.debug(Ljava/lang/String;Ljava/lang/Object;)V

gradle配置

dependencies {
    compile group: 'org.elasticsearch.client', name: 'transport', version:"5.1.1"
    compile 'org.apache.logging.log4j:log4j-api:2.4'
    compile 'org.apache.logging.log4j:log4j-core:2.4'
    compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.4'
    compile 'org.apache.logging.log4j:log4j-jcl:2.4'
    compile 'org.slf4j:jcl-over-slf4j:1.7.12'
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

以下是问题补充:

@sexants:2.4也有对应的方法,就是不知道为啥报错,直接升级到最新log4j,然后...... (2016/12/16 18:04)
加载中
0
寻梦2012
寻梦2012
n" java.lang.NoSuchMethodError: 你是jar包引的版本不对
返回顶部
顶部