Delete Watch by Java API get NPE

alerting

(Sayakiss) #1

In org.elasticsearch.client.transport.support:

public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void execute(final Action<Request, Response, RequestBuilder> action, final Request request, ActionListener<Response> listener) {
    final TransportActionNodeProxy<Request, Response> proxy = proxies.get(action);
    //try to get action "cluster:admin/watcher/watch/delete"  but returns null
    nodesService.execute(new TransportClientNodesService.NodeListenerCallback<Response>() {
        @Override
        public void doWithNode(DiscoveryNode node, ActionListener<Response> listener) {
            proxy.execute(node, request, listener);//proxy is null, so get NPE
        }
    }, listener);
}

The code to create client:

        client = TransportClient.builder().settings(
                Settings.settingsBuilder().put("cluster.name", "elasticsearch_dc_001").build()
        ).build()
                .addTransportAddress(
                        new InetSocketTransportAddress(
                                InetAddress.getByName("x.x.x.x"), 9300
                        )
                );

The code to delete watch:

    DeleteWatchResponse deleteWatchResponse = watcherClient.prepareDeleteWatch(getName(config)).setForce(true).get();

Full stack trace:

Exception in thread "main" java.lang.NullPointerException
	at org.elasticsearch.client.transport.support.TransportProxyClient$1.doWithNode(TransportProxyClient.java:58)
	at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:202)
	at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)
	at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:272)
	at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:347)
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85)
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:59)
	at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:67)
	at com.enniu.cloud.services.elasticsearch.WatcherManager.deleteWatch(WatcherManager.java:115)
	at com.enniu.cloud.services.elasticsearch.WatcherManager.lambda$delete$2(WatcherManager.java:100)
	at com.enniu.cloud.services.elasticsearch.WatcherManager$$Lambda$2/2128859746.apply(Unknown Source)
	at com.enniu.cloud.services.elasticsearch.WatcherManager.performOnWatch(WatcherManager.java:109)
	at com.enniu.cloud.services.elasticsearch.WatcherManager.delete(WatcherManager.java:99)
	at com.enniu.cloud.services.elasticsearch.WatcherManager.main(WatcherManager.java:133)

JAVA API version:

    <dependency>
        <groupId>org.elasticsearch.plugin</groupId>
        <artifactId>watcher</artifactId>
        <version>2.0.0-rc1</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch.plugin</groupId>
        <artifactId>license</artifactId>
        <version>2.0.0-rc1</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>2.0.0-rc1</version>
    </dependency>

(Alexander Reelsen) #2

please see the other topic here


(Ümit Seren) #3

Same issue.
I also added the plugin.types (http://stackoverflow.com/questions/33430240/elasticsearch-2-0-how-to-delete-by-query-in-java) but I get the same NullPointerException when trying to execute a delete-by-query through TransportClient.


(Alexander Reelsen) #4

Hey,

can you open a new issue, with code snippets showing the watcher action you execute via the WatcherClient as well as the telling us the version you are using so we can debug your issue further?

--Alex


(Ümit Seren) #5

Thanks for the feedback. I think I posted in the wrong thread. I get the NPE actually when I use the delete-by-query plugin. But it seems to be happen in the same place. I will create an issue tough.


(system) #6