# java.lang.NoClassDefFoundError: org/elasticsearch/transport/TcpChannel

**URL:** <https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875>\
**Category:** Elasticsearch\
**Created:** [December 21, 2017, 6:26pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875 "2017-12-21T18:26:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankur\_singla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankur_singla/32/45612_2.png) [@ankur\_singla](https://discuss.elastic.co/u/ankur_singla)\
**Post date:** [December 21, 2017, 6:26pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/1 "2017-12-21T18:26:23Z")

</div>

I am using 6.1.1 version of elastic but while building TransportClient using PreBuiltTransportClient this error comes up.

> ```
> Settings settings = Settings.builder()
> .put("cluster.name", "abcdef").build();
> TransportClient client = new PreBuiltTransportClient(settings)
> .addTransportAddress(new TransportAddress(InetAddress.getByName("xxxx.xx-xx-xx"), 1234))
> ;
> 
> BulkRequestBuilder bulkRequest = client.prepareBulk();
> 
> ```

If there is something that i am doing wrong please let me know.

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [December 21, 2017, 7:26pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/2 "2017-12-21T19:26:10Z")

</div>

What build tool do you use? How are you gathering the transport client jar and its transitive dependencies?

---

<div class="post-metadata">

**Author:** ![dearnomi](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@dearnomi](https://discuss.elastic.co/u/dearnomi)\
**Post date:** [December 21, 2017, 7:55pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/3 "2017-12-21T19:55:59Z")

</div>

Hello I am also having the same issue almost, Some time i get java.lang.NoClassDefFoundError (With different class name) and some time java.lang.NoSuchFieldError: LUCENE\_6\_0\_0

My code is below, It breaks on time of build new transport client.

TransportClient client = null;  
final Settings settings = Settings.builder().put("[cluster.name](http://cluster.name)", CLUSTER\_NAME).build();  
if (client == null) {  
client = new PreBuiltTransportClient(settings)  
.addTransportAddress(new TransportAddress(InetAddress.getByName(host), port));

```
    }

```

I am using maven as build tool and my POM entry for elasticsearch is

```
   <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>transport</artifactId>
        <version>6.1.0</version>
    </dependency>

```

Any one help is most appreciated as i spend whole day on this issue and totally stuck on it.

Thanks

---

<div class="post-metadata">

**Author:** ![dearnomi](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@dearnomi](https://discuss.elastic.co/u/dearnomi)\
**Post date:** [December 21, 2017, 7:58pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/4 "2017-12-21T19:58:54Z")

</div>

My complete stack trace is as follow

UT005023: Exception handling request to /api/inbox/index/vorgang: org.jboss.resteasy.spi.UnhandledException: java.lang.NoSuchFieldError: LUCENE\_6\_0\_0  
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)  
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)  
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)  
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)  
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)  
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)  
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)  
at de.init.commons.webapp.system.ssl.MarkSecureHandler.handleRequest(MarkSecureHandler.java:164)  
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)  
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)  
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)  
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)  
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)  
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)  
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:748)  
Caused by: java.lang.NoSuchFieldError: LUCENE\_6\_0\_0  
at org.elasticsearch.Version.(Version.java:44)  
at org.elasticsearch.common.io.stream.StreamOutput.(StreamOutput.java:76)  
at org.elasticsearch.common.io.stream.BytesStream.(BytesStream.java:24)  
at org.elasticsearch.common.io.stream.BytesStreamOutput.(BytesStreamOutput.java:59)  
at org.elasticsearch.common.io.stream.BytesStreamOutput.(BytesStreamOutput.java:56)  
at org.elasticsearch.common.io.stream.BytesStreamOutput.(BytesStreamOutput.java:46)  
at org.elasticsearch.common.xcontent.XContentBuilder.builder(XContentBuilder.java:69)  
at org.elasticsearch.common.settings.Setting.arrayToParsableString(Setting.java:1130)  
at org.elasticsearch.common.settings.Setting.access$600(Setting.java:84)  
at org.elasticsearch.common.settings.Setting$ListSetting.lambda$new$0(Setting.java:835)  
at org.elasticsearch.common.settings.Setting$ListSetting.getRaw(Setting.java:843)  
at org.elasticsearch.common.settings.Setting.lambda$listSetting$29(Setting.java:1094)  
at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:1099)  
at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:1094)  
at org.elasticsearch.transport.TcpTransport.(TcpTransport.java:130)  
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:98)  
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:128)  
at org.elasticsearch.client.transport.TransportClient.(TransportClient.java:262)  
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:128)  
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:114)  
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:104)  
at de.init.commons.webapp.features.app\_inbox.InboxAPI.createIndex(InboxAPI.java:490)  
at de.init.commons.webapp.features.app\_inbox.InboxAPI.indexVorgang(InboxAPI.java:449)  
at

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [December 21, 2017, 8:35pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/5 "2017-12-21T20:35:18Z")

</div>

@dearnomi Does your application also depend on Lucene directly? This could happen if you have jarhell, and an older version of Lucene is "winning" in the race to be loaded.

---

<div class="post-metadata">

**Author:** ![dearnomi](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@dearnomi](https://discuss.elastic.co/u/dearnomi)\
**Post date:** [December 21, 2017, 8:52pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/6 "2017-12-21T20:52:04Z")

</div>

Thanks Ryan, No there is no direct lucene dependency, i clean my project and even removed lucene from .m2 directory.

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [December 21, 2017, 9:33pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/7 "2017-12-21T21:33:48Z")

</div>

Can you run `mvn dependency:tree` on your project?

---

<div class="post-metadata">

**Author:** ![dearnomi](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@dearnomi](https://discuss.elastic.co/u/dearnomi)\
**Post date:** [December 21, 2017, 10:24pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/8 "2017-12-21T22:24:17Z")

</div>

My project's complete dependency tree is too large and cant paste here, i am posting here only the elastic part here

+- org.elasticsearch.client:transport:jar:6.1.0:compile  
| +- org.elasticsearch:elasticsearch:jar:6.1.0:compile  
| | +- org.apache.lucene:lucene-core:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-analyzers-common:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-backward-codecs:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-grouping:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-highlighter:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-join:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-memory:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-misc:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-queries:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-queryparser:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-sandbox:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-spatial:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-spatial-extras:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-spatial3d:jar:7.1.0:compile  
| | +- org.apache.lucene:lucene-suggest:jar:7.1.0:compile  
| | +- org.elasticsearch:securesm:jar:1.2:compile  
| | +- org.elasticsearch:elasticsearch-cli:jar:6.1.0:compile  
| | +- com.carrotsearch:hppc:jar:0.7.1:compile  
| | +- org.yaml:snakeyaml:jar:1.17:compile  
| | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.8.10:compile  
| | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.10:compile  
| | +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.10:compile  
| | +- com.tdunning:t-digest:jar:3.0:compile  
| | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile  
| | +- org.apache.logging.log4j:log4j-api:jar:2.9.1:compile  
| | - org.elasticsearch:jna:jar:4.4.0-1:compile  
| +- org.elasticsearch.plugin:transport-netty4-client:jar:6.1.0:compile  
| | +- io.netty:netty-buffer:jar:4.1.13.Final:compile  
| | +- io.netty:netty-codec:jar:4.1.13.Final:compile  
| | +- io.netty:netty-codec-http:jar:4.1.13.Final:compile  
| | +- io.netty:netty-common:jar:4.1.13.Final:compile  
| | +- io.netty:netty-handler:jar:4.1.13.Final:compile  
| | +- io.netty:netty-resolver:jar:4.1.13.Final:compile  
| | - io.netty:netty-transport:jar:4.1.13.Final:compile  
| +- org.elasticsearch.plugin:reindex-client:jar:6.1.0:compile  
| | - org.elasticsearch.client:elasticsearch-rest-client:jar:6.1.0:compile  
| | +- org.apache.httpcomponents:httpasyncclient:jar:4.1.2:compile  
| | - org.apache.httpcomponents:httpcore-nio:jar:4.4.5:compile  
| +- org.elasticsearch.plugin:lang-mustache-client:jar:6.1.0:compile  
| | - com.github.spullara.mustache.java:compiler:jar:0.9.3:compile  
| +- org.elasticsearch.plugin:percolator-client:jar:6.1.0:compile  
| | - org.elasticsearch.plugin:mapper-extras:jar:6.1.0:compile  
| - org.elasticsearch.plugin:parent-join-client:jar:6.1.0:compile

i verified that in complete tree there is no where Lucene included.

---

<div class="post-metadata">

**Author:** ![dearnomi](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@dearnomi](https://discuss.elastic.co/u/dearnomi)\
**Post date:** [December 21, 2017, 10:40pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/9 "2017-12-21T22:40:15Z")

</div>

Is this can be maven shade issue? I seen on some discussion

> <https://stackoverflow.com/questions/39023903/elasticsearch-transportclient-fails-with-could-not-initialize-class-org-elastics/39023904#39023904>

> <https://github.com/elastic/elasticsearch/issues/3350>

I also followed as per but could not figured out the solution.

---

<div class="post-metadata">

**Author:** ![ankur\_singla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankur_singla/32/45612_2.png) [@ankur\_singla](https://discuss.elastic.co/u/ankur_singla)\
**Post date:** [December 22, 2017, 1:49am UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/10 "2017-12-22T01:49:56Z")

</div>

I am using maven

```
> <dependency>
> <groupId>org.elasticsearch.client</groupId>
> <artifactId>elasticsearch-rest-high-level-client</artifactId>
> <version>6.0.1</version>
> </dependency>
> 
> <dependency>
> <groupId>org.elasticsearch.client</groupId>
> <artifactId>transport</artifactId>
> <version>6.1.1</version>
> </dependency>

```

> Blockquote

---

<div class="post-metadata">

**Author:** ![ankur\_singla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankur_singla/32/45612_2.png) [@ankur\_singla](https://discuss.elastic.co/u/ankur_singla)\
**Post date:** [December 22, 2017, 2:09am UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/11 "2017-12-22T02:09:21Z")

</div>

> [@dearnomi](#):
>
> paste

Got the issue it was conflicting with restclient version thanks for the response @rjernst

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [December 22, 2017, 7:57pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/12 "2017-12-22T19:57:08Z")

</div>

If you are shading and building an uber jar, then yes, that could be your issue.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 19, 2018, 7:57pm UTC](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-transport-tcpchannel/112875/13 "2018-01-19T19:57:30Z")

</div>

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