I'm trying to implement autocomple feature using elaticsearch 6.2.4 and its java rest client api on my maven web application which is running under glassfish 4.1
despite all my efforts, I still encounter the same error:
java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW
I have read some about it, and made changes accodingly essentielly on project dependencies( inside pom.xml) because all responses that i met, turned arround conflict on jackson library version.
here is the code that I tried to run:
java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW
at org.elasticsearch.common.xcontent.json.JsonXContent.<clinit>(JsonXContent.java:57)
at org.elasticsearch.common.xcontent.XContentFactory.contentBuilder(XContentFactory.java:121)
at org.elasticsearch.search.suggest.completion.CompletionSuggestionBuilder.contexts(CompletionSuggestionBuilder.java:203)
at com.trustiser.business.ElasticSearchDao1.AutoCompleteMemberTopic(ElasticSearchDao1.java:50)
at com.trustiser.service.SearchEngineService.searchMemberCategory(SearchEngineService.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103)
Hi,
not for this project when I isolate the autocomplete functionality to easiely resolves it.
I shared the dependency tree, and I have checked that 2.8.2 is the only bversion that my project used
also,
the version that I provide (2.8.10) is the one that is used by ES API 6.2.4, because when don't define it explicitly, 2.8.10 is the version that is added!!!
at some point you do have a build process that results in a .war or .jar file or something, that you deploy to glassfish - this is the artifact I want you to check.
the artifact is a war file, I check the dependency under web-inf/lib, it seems that every thing is ok concerning jackson version.
I attached a screen shots of the projet's dependency
Hi @spinscale ,
you were right, shading ES hight level client api was the solution of the conflict beteween it and existing jars on glassfish modules ( Jackson-core is one of them).
These are followed steps to implement the solution:
Create the shaded dependency of ES:
Create a java maven project;
Run clean, build and maven package goal;
The jar will be created on "elastic shade project location" \target
Add the shaded dependency on maven local repository:
Access to m2 repository from the cmd, the default location is C:\Users"user".m2\repository , and execute the following command to istall the created dependency: mvn install:install-file -Dfile="location of the shaded elastic dependency".jar -DgroupId="shaded dependency groupe id" -DartifactId="shaded dependency acrifact id" -Dversion="version of the shaded dependency" -Dpackaging=jar
Add the shaded dependency of elasticsearch on the pom.xml of my maven java web application instead of using elasticsearch hight level rest api directly
To avoid log4j error I add a log4j2.properties file on the resources directory of my java web app :
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.