Maven couldn't transfer "elasticsearch-watcher:pom:2.0.0-rc1" due to authorization

In official doc of watcher, it claims one should add this maven dependency to pom.xml to use watcher plugin:

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

But when I doing this so, mvn clean install gives:

 Could not transfer artifact org.elasticsearch.plugin:elasticsearch-watcher:pom:2.0.0-rc1 from/to elasticsearch-releases (http://maven.elasticsearch.org/releases): Not authorized

Whole message:

Failed to execute goal on project crawler-elasticsearch: Could not resolve dependencies for project com.enniu.cloud.services:crawler-elasticsearch:jar:1.2-SNAPSHOT: Failed to collect dependencies at org.elasticsearch.plugin:elasticsearch-watcher:jar:2.0.0-rc1: Failed to read artifact descriptor for org.elasticsearch.plugin:elasticsearch-watcher:jar:2.0.0-rc1: Could not transfer artifact org.elasticsearch.plugin:elasticsearch-watcher:pom:2.0.0-rc1 from/to elasticsearch-releases (http://maven.elasticsearch.org/releases): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]


By the way, we trying to use watcher 2.0.0-rc1 because now we have upgraded our elasticsearch to 2.0.0-rc1 .

If we can't use 2.0.0-rc1 of watcher, which version should we use with elasticsearch 2.0.0-rc1?

Hey,

can you try this and tell me if it works? Looks as if the docs are wrong, but I want to be sure first:

    <repositories>
        <repository>
            <id>publicesrepo</id>
            <name>publicesrepo</name>
            <url>http://maven.elasticsearch.org/public-releases</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>2.0.0-rc1</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>shield</artifactId>
            <version>2.0.0-rc1</version>
        </dependency>
        <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>
    </dependencies>

--Alex

It works. BTW, @warkolm told me watcher 2.0.0-rc1 not available now in elasticsearch IRC.

I get NPE in this line:

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

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:120)
	at com.enniu.cloud.services.elasticsearch.WatcherManager.lambda$delete$1(WatcherManager.java:105)
	at com.enniu.cloud.services.elasticsearch.WatcherManager$$Lambda$2/1143968486.apply(Unknown Source)
	at com.enniu.cloud.services.elasticsearch.WatcherManager.performOnWatch(WatcherManager.java:114)
	at com.enniu.cloud.services.elasticsearch.WatcherManager.delete(WatcherManager.java:104)
	at com.enniu.cloud.services.elasticsearch.WatcherManager.main(WatcherManager.java:138)

partial logs:

18:36:42.969 [main] DEBUG org.elasticsearch.common.netty - using gathering [true]
18:36:43.041 [main] DEBUG org.elasticsearch.client.transport - [Persuasion] node_sampler_interval[5s]
18:36:43.081 [main] DEBUG o.e.n.c.socket.nio.SelectorUtil - Using select timeout of 500
18:36:43.081 [main] DEBUG o.e.n.c.socket.nio.SelectorUtil - Epoll-bug workaround enabled = false
18:36:43.146 [main] DEBUG org.elasticsearch.client.transport - [Persuasion] adding address [{#transport#-1}{10.0.40.156}{10.0.40.156:9300}]
18:36:43.352 [main] DEBUG org.elasticsearch.transport.netty - [Persuasion] connected to node [{#transport#-1}{10.0.40.156}{10.0.40.156:9300}]
18:36:43.429 [main] DEBUG org.elasticsearch.transport.netty - [Persuasion] connected to node [{crawler_service_001}{ppqfzmczTPCnu1-b7wOiIA}{127.0.0.1}{10.0.40.156:9300}]
Exception in thread "main" java.lang.NullPointerException
...

Hey,

this looks as if the client you are using does not load the watcher plugin. Can you show code, where you instantiate the client that you wrap around WatcherClient

        Settings settings = Settings.builder().put("plugin.types", WatcherPlugin.class.getName()).build();

        TransportClient client = TransportClient.builder().settings(settings).build();
        client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
        WatcherClient watcherClient = new WatcherClient(client);

in addition you can try the above snippet and see if it works.

--Alex

The code to instantiate the WathcerClient:

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

That works! But I think it would be better if that code appears in watcher 2.0.0 official docs.

absolutely. I'll add it soon. Thanks for your patience!

--Alex

thanks for your answer,it hepls me work with the shield plugin.