Unsupported http.type [netty3] when trying to start embedded elasticsearch node


(Rajind Ruparathna) #1

I know that embedded Elasticsearch is not recommended. I'm just trying it for testing purposes.

I'm trying to start an embedded Elasticsearch node giving the configuration from the following elasticsearch.yml

# Name for the cluster
cluster.name: elasticsearch
# Name for the embedded node
node.name: EmbeddedESNode
# Path to log files:
path.logs: logs
discovery.zen.ping.unicast.hosts: []
# Disable dynamic scripting
script.inline: false
script.stored: false
script.file: false
transport.type: local
http.type: netty3

I'm using es 5.1.1 and my code to start embedded node is as follows.

    try {
        Settings elasticsearchSetting = Settings.builder()
                // Value for path.home is required for es but will not be used as long as other properties
                // path.logs, path.data and path.conf is set.
                .put(ES_PROPERTY_PATH_HOME, "nullpath")
                .put(ES_PROPERTY_PATH_CONF, confDir)
                .build();
        Node node = new Node(elasticsearchSetting).start();
        logger.info("Embedded Elasticsearch server successfully started ...");

    } catch (Exception e) {
        throw e;
    }

I get the following trace.

java.lang.IllegalStateException: Unsupported http.type [netty3]
	at org.elasticsearch.common.network.NetworkModule.getHttpServerTransportSupplier(NetworkModule.java:194) ~[elasticsearch-5.1.1.jar:5.1.1]
	at org.elasticsearch.node.Node.<init>(Node.java:396) ~[elasticsearch-5.1.1.jar:5.1.1]
	at org.elasticsearch.node.Node.<init>(Node.java:229) ~[elasticsearch-5.1.1.jar:5.1.1]
	at org.elasticsearch.node.Node.<init>(Node.java:225) ~[elasticsearch-5.1.1.jar:5.1.1]
	... 18 more

I've tried with http.type: netty4 as well but no luck so far. It works when http.enabled:false is set but I want to use http rest api for testing.

P.S:
I've been using this elasticsearch hadoop class for reference in implementing embedded es and unfortunately I couldn't find any docs on http.type.

Can't I start an embedded node with http now in ES 5.x ?
What am i doing wrong here ?

Any help is highly appreciated.


(Mark Walkom) #2

It's entirely not supported, so you are unlikely to get any assistance on this sorry to say :frowning:


(Rajind Ruparathna) #3

Can we not use it even for test cases ?


(Mark Walkom) #4

Have a read of https://www.elastic.co/blog/elasticsearch-the-server


(Rajind Ruparathna) #5

Thanks. I've read that already.


(David Pilato) #6

If you are looking for integration tests, you can also try http://david.pilato.fr/blog/2016/10/18/elasticsearch-real-integration-tests-updated-for-ga/

You can also read https://www.elastic.co/guide/en/elasticsearch/reference/5.1/integration-tests.html which might help.


(Rajind Ruparathna) #7

@dadoonet Thank you very much for the positive reply. I'll take a look. :slight_smile:


(Rajind Ruparathna) #8

The solution was already there in es-hadoop embedded es implementation.

private static class PluginConfigurableNode extends Node {
        public PluginConfigurableNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
            super(InternalSettingsPreparer.prepareEnvironment(settings, null), classpathPlugins);
        }
}

We can give netty3 as a plugin as follows. Then everything works well.

Collection plugins = Arrays.asList(Netty3Plugin.class);
Node node = new PluginConfigurableNode(elasticsearchSetting, plugins).start();

(system) #9

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.