Elasticsearch not working in Wildfly 10 after upgrading to 2.1.1


#1

I am working on a Java EE 7 WebApplication (running in wildfly 10) using an embedded Elasticsearch. After upgrading to elasticsearch 2.1.1 searching is not working anymore. (indexing seems to work)

Dependencies that worked:

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>2.0.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-core</artifactId>
    <version>5.2.1</version>
</dependency>

Upgraded dependencies:

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>2.1.1</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-core</artifactId>
    <version>5.3.1</version>
</dependency>

After indexing a very basic document (indexing seems to work), searching fails with the following exception:

org.elasticsearch.action.search.SearchPhaseExecutionException : all shards failed [Proxied because : Original exception caused: class java.io.NotSerializableException: org.elasticsearch.action.search.ShardSearchFailure]
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:228)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.onFailure(TransportSearchTypeAction.java:174)
at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:46)
at org.elasticsearch.transport.local.LocalTransport.handleException(LocalTransport.java:354)
at org.elasticsearch.transport.local.LocalTransport.handlerResponseError(LocalTransport.java:345)
at org.elasticsearch.transport.local.LocalTransport.messageReceived(LocalTransport.java:241)
at org.elasticsearch.transport.local.LocalTransportChannel$2.run(LocalTransportChannel.java:99)
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:745)
Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: _byteSymbolCanonicalizer
at com.fasterxml.jackson.dataformat.smile.SmileFactory._createParser(SmileFactory.java:404)
at com.fasterxml.jackson.dataformat.smile.SmileFactory.createParser(SmileFactory.java:327)
at org.elasticsearch.common.xcontent.smile.SmileXContent.createParser(SmileXContent.java:107)
at org.elasticsearch.common.xcontent.smile.SmileXContent.createParser(SmileXContent.java:113)
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:817)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:651)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:617)
at org.elasticsearch.search.SearchService.executeDfsPhase(SearchService.java:262)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchDfsTransportHandler.messageReceived(SearchServiceTransportAction.java:360)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchDfsTransportHandler.messageReceived(SearchServiceTransportAction.java:357)
at org.elasticsearch.transport.local.LocalTransport$2.doRun(LocalTransport.java:280)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
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:745)


(Jörg Prante) #2

Check your runtime classpath. You need Jackson 2.6.2, it seems you have older versions.


#3

Thanks for your answer!

I have jackson 2.6.2 in my classpath. (core, databind and dataformat-*)

Could it be that some of jboss-resteasy libraries are interfering?
I have them in provided scope as i am running in wildfly 10.


(David Pilato) #4

May be this can help?


(Jörg Prante) #5

I think you are on Wildfly 10 CR5. Provided scope does not make a difference, and although RESTeasy is a PITA, Jackson is a core Wildfly module. Check $WILDFLY_HOME/modules/system/layers/base/, from there you can see that WF is using Jackson 2.5.4 and not 2.6.2. So it can't be possible that you have 2.6.2. in your WF runtime classpath (except those jars in your ES web app)

I would try to update Jackson 2.5.5 with 2.6.2 jars in WF. If that is not possible, you must build ES jar with shaded dependencies, as @dadoonet suggested.


#6

I think you're right. Thanks for clearing that up.
Could it be possible to somehow exclude wildfly jackson via a "jboss-deployment-structure.xml" and have my app include its required library?


(Jörg Prante) #7

This is not the 100% WIildfly forum, but as far as I can judge, for RESTeasy, you could try something like

<jboss-deployment-structure>
    <deployment>
        <exclusions>
           <module name="org.jboss.resteasy.resteasy-jackson2-provider"/>
        </exclusions>
    </deployment>
</jboss-deployment-structure> 

and then removing the Jackson jars from $WILDFLY_HOME/modules/system/layers/base/. Note that this removes all Jackson functionality from Wildfly unless you supply the jars again.


(system) #8