java.lang.ClassNotFoundException: org.elasticsearch.script.ScriptEngine
Elasticsearch | 作者 wspph | 发布于2018年07月20日 | 阅读数:9120
使用es6+的版本,配置启动报错,5的就不会
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.script.ScriptEngine
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 78 more
配置是这样的
Settings esSettings = Settings.builder()
.put("cluster.name", "wspph_elasticsearch")
.put("client.transport.sniff", true)
.build();
TransportClient client = null;
try {
client = new PreBuiltTransportClient(esSettings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("192.168.1.207"), 9300));
} catch (UnknownHostException e) {
e.printStackTrace();
}
System.out.println("ElasticsearchClient 连接成功");
return client;
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.script.ScriptEngine
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 78 more
配置是这样的
Settings esSettings = Settings.builder()
.put("cluster.name", "wspph_elasticsearch")
.put("client.transport.sniff", true)
.build();
TransportClient client = null;
try {
client = new PreBuiltTransportClient(esSettings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("192.168.1.207"), 9300));
} catch (UnknownHostException e) {
e.printStackTrace();
}
System.out.println("ElasticsearchClient 连接成功");
return client;
2 个回复
wspph - IT
赞同来自:
compile group: 'org.elasticsearch.client', name: 'transport', version: '6.3.1'
会报异常:Caused by: java.lang.ClassNotFoundException: org.elasticsearch.script.ScriptEngine
换成
compile group: 'org.elasticsearch.client', name: 'transport', version: '5.6.1' 就正常了
medcl - 今晚打老虎。
赞同来自: