You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by PedroMrChaves <pe...@gmail.com> on 2016/10/28 16:59:43 UTC

Elasticsearch sink: Java.lang.NoSuchMethodError: org.elasticsearch.common.settings.Settings.settingsBuilder

Hello,

I am using Flink to write data to elasticsearch.

Flink version : 1.1.3
Elasticsearch version: 2.4.1

But I am getting the following error:

1/0/28/2016 18:58:56     Job execution switched to status FAILING.
java.lang.NoSuchMethodError:
org.elasticsearch.common.settings.Settings.settingsBuilder()Lorg/elasticsearch/common/settings/Settings$Builder;
        at
org.apache.flink.streaming.connectors.elasticsearch2.ElasticsearchSink.open(ElasticsearchSink.java:162)
        at
org.apache.flink.api.common.functions.util.FunctionUtils.openFunction(FunctionUtils.java:38)
        at
org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator.open(AbstractUdfStreamOperator.java:91)
        at
org.apache.flink.streaming.runtime.tasks.StreamTask.openAllOperators(StreamTask.java:376)
        at
org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:256)
        at org.apache.flink.runtime.taskmanager.Task.run(Task.java:585)
        at java.lang.Thread.run(Thread.java:745)/

This is the code I use to configure the sink (similar to the taxi ride
example in
https://www.elastic.co/blog/building-real-time-dashboard-applications-with-apache-flink-elasticsearch-and-kibana) 

/    private void elasticSink() {
        Map<String, String> config = new HashMap<>();
        // This instructs the sink to emit after every element, otherwise
they would be buffered
        config.put("bulk.flush.max.actions", "10");
        config.put("cluster.name", "elasticdemo");

        List<InetSocketAddress> transports = new ArrayList<>();
        try {
            transports.add(new
InetSocketAddress(InetAddress.getByName("localhost"), 9200));
        } catch (UnknownHostException ex) {
            Logger.getLogger(CEPEngine.class.getName()).log(Level.SEVERE,
null, ex);
        }

        stream.addSink(new ElasticsearchSink<>(
                config,
                transports,
                new AccessDataInsert()));

    }/

What could be the problem?

Regards,
Pedro Chaves




--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Elasticsearch-sink-Java-lang-NoSuchMethodError-org-elasticsearch-common-settings-Settings-settingsBur-tp9773.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.

Re: Elasticsearch sink: Java.lang.NoSuchMethodError: org.elasticsearch.common.settings.Settings.settingsBuilder

Posted by Till Rohrmann <tr...@apache.org>.
Hi Pedro,

this looks like a version mismatch. Could you check which version of
elasticsearch you've in your classpath respectively uber jar? It should be
the version 2.3.5.

Cheers,
Till

On Fri, Oct 28, 2016 at 6:59 PM, PedroMrChaves <pe...@gmail.com>
wrote:

> Hello,
>
> I am using Flink to write data to elasticsearch.
>
> Flink version : 1.1.3
> Elasticsearch version: 2.4.1
>
> But I am getting the following error:
>
> 1/0/28/2016 18:58:56     Job execution switched to status FAILING.
> java.lang.NoSuchMethodError:
> org.elasticsearch.common.settings.Settings.settingsBuilder()Lorg/
> elasticsearch/common/settings/Settings$Builder;
>         at
> org.apache.flink.streaming.connectors.elasticsearch2.
> ElasticsearchSink.open(ElasticsearchSink.java:162)
>         at
> org.apache.flink.api.common.functions.util.FunctionUtils.
> openFunction(FunctionUtils.java:38)
>         at
> org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator.open(
> AbstractUdfStreamOperator.java:91)
>         at
> org.apache.flink.streaming.runtime.tasks.StreamTask.
> openAllOperators(StreamTask.java:376)
>         at
> org.apache.flink.streaming.runtime.tasks.StreamTask.
> invoke(StreamTask.java:256)
>         at org.apache.flink.runtime.taskmanager.Task.run(Task.java:585)
>         at java.lang.Thread.run(Thread.java:745)/
>
> This is the code I use to configure the sink (similar to the taxi ride
> example in
> https://www.elastic.co/blog/building-real-time-dashboard-
> applications-with-apache-flink-elasticsearch-and-kibana)
>
> /    private void elasticSink() {
>         Map<String, String> config = new HashMap<>();
>         // This instructs the sink to emit after every element, otherwise
> they would be buffered
>         config.put("bulk.flush.max.actions", "10");
>         config.put("cluster.name", "elasticdemo");
>
>         List<InetSocketAddress> transports = new ArrayList<>();
>         try {
>             transports.add(new
> InetSocketAddress(InetAddress.getByName("localhost"), 9200));
>         } catch (UnknownHostException ex) {
>             Logger.getLogger(CEPEngine.class.getName()).log(Level.SEVERE,
> null, ex);
>         }
>
>         stream.addSink(new ElasticsearchSink<>(
>                 config,
>                 transports,
>                 new AccessDataInsert()));
>
>     }/
>
> What could be the problem?
>
> Regards,
> Pedro Chaves
>
>
>
>
> --
> View this message in context: http://apache-flink-user-
> mailing-list-archive.2336050.n4.nabble.com/Elasticsearch-sink-Java-lang-
> NoSuchMethodError-org-elasticsearch-common-settings-
> Settings-settingsBur-tp9773.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> at Nabble.com.
>