NoClassDefFoundError: Could not initialize class org.elasticsearch.common.xcontent.smile.SmileXContent

Hi trying to port an application from 1.7.3 to 2.1.0

I have the following dependency...

	</dependency>
	<dependency>
		<groupId>org.elasticsearch</groupId>
		<artifactId>elasticsearch</artifactId>
		<version>2.1.0</version>
	</dependency>

But I keep getting the following exception on execution...

java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.xcontent.smile.SmileXContent
at org.elasticsearch.common.xcontent.XContentFactory.contentBuilder(XContentFactory.java:124) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.support.ToXContentToBytes.buildAsBytes(ToXContentToBytes.java:62) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.search.SearchRequest.source(SearchRequest.java:250) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.search.SearchRequestBuilder.beforeExecute(SearchRequestBuilder.java:1019) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.search.SearchRequestBuilder.beforeExecute(SearchRequestBuilder.java:50) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85) ~[elasticsearch-2.1.0.jar:2.1.0]
at com.xxx.vertx.es.ElasticsearchClient.doSearch(ElasticsearchClient.java:262) ~[com.xxx~xxx~02.00.00/:na]
at com.xxx.vertx.es.ElasticsearchClient.handle(ElasticsearchClient.java:142) ~[com.xxx~xxx~02.00.00/:na]
at com.xxx.vertx.es.ElasticsearchClient.handle(ElasticsearchClient.java:34) ~[com.xxx~xxx~02.00.00/:na]
at org.vertx.java.core.eventbus.impl.DefaultEventBus$11.run(DefaultEventBus.java:951) ~[vertx-core-2.1.2-xxx-ssl-fix.jar:na]
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:175) ~[vertx-core-2.1.2-xxx-ssl-fix.jar:na]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:370) [netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353) [netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [netty-all-4.0.20.Final.jar:4.0.20.Final]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_11]

And here is is the error just before that.

java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW
at org.elasticsearch.common.xcontent.smile.SmileXContent.(SmileXContent.java:50) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.common.xcontent.XContentFactory.contentBuilder(XContentFactory.java:124) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.support.ToXContentToBytes.buildAsBytes(ToXContentToBytes.java:62) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.search.SearchRequest.source(SearchRequest.java:250) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.search.SearchRequestBuilder.beforeExecute(SearchRequestBuilder.java:1019) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.search.SearchRequestBuilder.beforeExecute(SearchRequestBuilder.java:50) ~[elasticsearch-2.1.0.jar:2.1.0]
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85) ~[elasticsearch-2.1.0.jar:2.1.0]
at com.xxx.vertx.es.ElasticsearchClient.doSearch(ElasticsearchClient.java:262) ~[com.xxx~xxx~02.00.00/:na]
at com.xxx.vertx.es.ElasticsearchClient.handle(ElasticsearchClient.java:142) ~[com.xxx~xxx~02.00.00/:na]
at com.xxx.vertx.es.ElasticsearchClient.handle(ElasticsearchClient.java:34) ~[com.xxx~xxx~02.00.00/:na]
at org.vertx.java.core.eventbus.impl.DefaultEventBus$11.run(DefaultEventBus.java:951) ~[vertx-core-2.1.2-xxx-ssl-fix.jar:na]
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:175) ~[vertx-core-2.1.2-xxx-ssl-fix.jar:na]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:370) [netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353) [netty-all-4.0.20.Final.jar:4.0.20.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [netty-all-4.0.20.Final.jar:4.0.20.Final]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_11]

It sounds like you are missing some dependencies.

How did you add elasticsearch to your project? Using Maven?

Please use Jackson 2.6.2 on classpath with ES 2.1, not Jackson =< 2.3

2 Likes

@dadoonet Yeah I used maven

@jprante Ok using Vert.x 2.1 which also has Jackson in it's lib folder probably the issue....

Hey,
I am getting the same error.
Could you please tell me how you resolved this and why is this issue.

Regards

Make sure you don't have another dependency with older Jackson?

Yes . An older version of Jackson was coming in my classpath.. Resolved it my removal of older version. thanks