Settings settings = Settings.builder().put("cluster.name", "xxx").put("client.transport.sniff",true).put("shield.user","xxx:xxx").build();
try {
client = new PreBuiltTransportClient(settings, ShieldPlugin.class)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("xxx"), 9300))
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("xxx"), 9300));
} catch (UnknownHostException e) {
e.printStackTrace();
}
这样获取客户端,报错如下:
Exception in thread "main" java.lang.VerifyError: class org.elasticsearch.shield.ShieldPlugin overrides final method onModule.(Lorg/elasticsearch/action/ActionModule;)V
看了下5.0的plugin,
/** @deprecated */
@Deprecated
public final void onModule(IndexModule indexModule) {
}
/** @deprecated */
@Deprecated
public final void onModule(SettingsModule settingsModule) {
}
/** @deprecated */
@Deprecated
public final void onModule(ScriptModule module) {
}
/** @deprecated */
@Deprecated
public final void onModule(AnalysisModule module) {
}
/** @deprecated */
@Deprecated
public final void onModule(ActionModule module) {
}
/** @deprecated */
@Deprecated
public final void onModule(SearchModule module) {
}
都已经是final,所以报错
这个有什么方法可以代替吗?
0 个回复