Java api fail_on_symbol_hash_overflow error

Hello everyone,

I'm coming to you because i have some issues in my development of the integration of the JAVA API on my application.
When I hit the endpoint which use the ELK Java API, I have this famous error :

 java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW

Before to come here, I did some research about it and I read a lot of topics and the most of them talk about a conflict of jackson-core versions, I think it's not my cause. Indeed, after a mvn dependency:tree , I got just one declaration of it here :

+- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.25:compile

| +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.25:compile
| +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.8.4:compile
| | +- com.fasterxml.jackson.core:jackson-core:jar:2.8.4:compile
| | - com.fasterxml.jackson.core:jackson-databind:jar:2.8.4:compile
| +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.8.4:compile
| | - com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.4:compile
| - com.fasterxml.jackson.core:jackson-annotations:jar:2.8.4:compile

The beauty of this error is anywhere in my code, I have the autocompletion and the proof that JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW is existing.

Despite of it, I still have the same issue. Any help ? Cause at this time, I'm screwing my head on the wall.

Thanks to you in advance.

I wonder if you have the wrong version of the dependency. What version of Elasticsearch?

I have the 5.1.2 version !
So, by the way, I exclude the jackson-core dependency from jersey-media. So, I have only the jackson-core dependency from the elasticsearch plugin. So the version of jackson-core is 2.8.1 . And, badly, I still have the same error...

I think that something is wrong with your runtime classpath. Would you please add System.out.println(System.getProperty("java.class.path")) to your application and share the results here?

There it is :
"Runtime classpath : /srv/glassfish4/glassfish/lib/javax.persistence-2.1.0.jar:/srv/glassfish4/glassfish/modules/glassfish.jar:/srv/glassfish4/glassfish/lib/monitor/flashlight-agent.jar"

I remove the build target of my application and I did a mvn clean install -DskipTests and the error disappears. But I have a new one ... :

java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.network.NetworkService
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:91)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:119)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:247)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:125)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:111)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:101)

There should be more to that stack trace, for example, an initial caused by exception.

There it is :

[2017-04-03T14:06:50.065+0200] [glassfish 4.1] [WARNING] [] [org.glassfish.jersey.internal.Errors] [tid: _ThreadID=33 _ThreadName=http-listener-1(4)] [timeMillis: 1491221210065] [levelValue: 900] [[ The following warnings have been detected: WARNING: Unknown HK2 failure detected: MultiException stack 1 of 2   java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.network.NetworkService
    at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:91)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:119)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:247)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:125)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:111)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:101)
at com.calade.smsmode.rest.resources.StatsResourceBis.<init>(StatsResourceBis.java:45)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1107)
at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:274)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:368)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:461)
at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:160)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2258)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:690)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:655)
at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:185)
at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:74)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:115)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:115)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:115)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:115)
at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:94)
at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:63)
at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:263)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:372)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at com.calade.smsmode.rest.filter.AuthenticationTokenProcessingFilter.doFilter(AuthenticationTokenProcessingFilter.java:60)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
at java.lang.Thread.run(Thread.java:745)

Okay, I still think that there should be more to this exception, namely I would expect below what you have pasted for there to a be a caused by exception. I'm looking for the cause of NetworkService class initializer failing.

I do see one potential place where NetworkService class initializer could fail, namely its class initializer could trigger the class initializer for NetworkUtils which has a dependency on Lucene. If you do not have the Lucene dependencies on your classpath, then this could fail. Can you ensure that the Lucene dependencies are on your runtime classpath?

Having that caused by exception that I'm referring to would either conclusively show this is indeed the problem, or if that's wrong, show us what the problem really is.

Do you have it?

How can I easily show you my classpath about Lucene ? But the Lucene's dependencies are automatically added with the elasticsearch one, aren't they ?
However, I can tell you when I do a mvn dependency:tree, I have the result below :

+- org.elasticsearch:elasticsearch:jar:5.1.2:compile
| +- org.apache.lucene:lucene-core:jar:6.3.0:compile
| +- org.apache.lucene:lucene-analyzers-common:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-backward-codecs:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-grouping:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-highlighter:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-join:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-memory:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-misc:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-queries:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-queryparser:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-sandbox:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-spatial:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-spatial-extras:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-spatial3d:jar:6.3.0:compile
| | +- org.apache.lucene:lucene-suggest:jar:6.3.0:compile

But there is true there is a an exception I didn't notice :

    java.lang.IllegalStateException: Unable to perform operation: create on com.calade.smsmode.rest.resources.StatsResourceBis
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:395)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:461)
at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:160)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2258)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:690)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:655)
at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)

Exactly the same as before when we found that Jackson was indeed on the classpath twice, just print System.getProperty("java.class.path") to the console.

The stack trace that you show is not what i'm looking for.

Sorry but the classpath is still the same as before, e.g :

/srv/glassfish4/glassfish/lib/javax.persistence-2.1.0.jar:/srv/glassfish4/glassfish/modules/glassfish.jar:/srv/glassfish4/glassfish/lib/monitor/flashlight-agent.jar

Then if that was the whole classpath before, Lucene is indeed not there and I believe that that is your problem.

You have to know I do this printl just before :

client = new PreBuiltTransportClient(settings);

because this is this line which causes the error.
So, up to you, I have to add lucene in my pom.xml ? In addition of the dependency of elasticsearch ?

It's very difficult for me to say conclusively without knowing the full details or your deployment model, sorry. One thing that I would suggest is checking whether or not you're excluding any dependencies in your POM? It appears to me though that your problem is going from compile time to runtime, so I'd check how your deploying and ensure that you're capturing all dependencies including transitive dependencies upon deployment.

I'm using glassfish 4 as application server. This project where I want to include the elasticsearch dependency is an api-rest project which is itself included in a parent project, but at this time, it only depends on another project named "service" which contains all of my jpa queries to my databases.
In my pom.xml of my rest project, there are my exclusions :

<dependency>
    <groupId>org.glassfish.jersey.ext</groupId>
    <artifactId>jersey-spring3</artifactId>
    <version>${jersey.version}</version>
       <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
            </exclusion>
            
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>${jersey.version}</version>
        <exclusions>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

Sure, like I said, I think it's on the deployment side which I have no visibility in to.

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