java.lang.NoClassDefFoundError: Could not initialize class com.twitter.finagle.stats.DefaultStatsReceiver$

Got the following error when executing our custom elasticsearch plugin.

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.twitter.finagle.stats.DefaultStatsReceiver$
        at com.twitter.finagle.stats.DefaultStatsReceiver.scope(LoadedStatsReceiver.scala) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.discoveryapi.client.servicemetrics.ZipkinAPITracer.getTracer(ZipkinAPITracer.java:235) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.discoveryapi.client.servicemetrics.ZipkinAPITracer.clientSend(ZipkinAPITracer.java:98) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.discoveryapi.client.MetricsServiceDiscoveryLookup.lookupService(MetricsServiceDiscoveryLookup.java:55) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.http.impl.WeURLProviderImpl$2.invoke(WeURLProviderImpl.java:93) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.http.impl.WeURLProviderImpl$DefaultInvocationHandler.invoke(WeURLProviderImpl.java:153) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.http.impl.WeURLProviderImpl.nextService(WeURLProviderImpl.java:90) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.http.impl.WeURLProviderImpl.<init>(WeURLProviderImpl.java:69) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.http.impl.WeURLProviderImpl.<init>(WeURLProviderImpl.java:57) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.http.impl.LazyWeURLProviderImpl$1.get(LazyWeURLProviderImpl.java:53) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.http.impl.LazyWeURLProviderImpl$1.get(LazyWeURLProviderImpl.java:49) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:160) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.http.impl.LazyWeURLProviderImpl.get(LazyWeURLProviderImpl.java:111) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.http.impl.LazyWeURLProviderImpl.get(LazyWeURLProviderImpl.java:42) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.commons.http.jersery.JerseyURLProvider.<init>(JerseyURLProvider.java:56) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.commons.http.jersery.JerseyURLProvider.create(JerseyURLProvider.java:84) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.sts.client.impl.StsServiceRESTClientImpl.getStsWebTarget(StsServiceRESTClientImpl.java:330) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.sts.client.impl.StsServiceRESTClientImpl.getValidationCert(StsServiceRESTClientImpl.java:173) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.sts.IdentityTokenJWT.getValidationCertImpl(IdentityTokenJWT.java:284) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.sts.IdentityTokenJWT.access$000(IdentityTokenJWT.java:70) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.sts.IdentityTokenJWT$1.create(IdentityTokenJWT.java:97) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.sts.IdentityTokenJWT$1.create(IdentityTokenJWT.java:94) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        at com.issinc.we.utils.factory.FactoryUtils.lambda$memoize$0(FactoryUtils.java:62) ~[we-elastic-svc-2.1.3-SNAPSHOT.jar:?]
        ... 64 more

I verified that com.twitter.finagle.stats.DefaultStatsReceiver is included in the plugin jar. Any idea on what could be going on?

Can you please provide more information about how you build your plugin? Do you have an example binary that can be inspected?

It's a fat jar with all the classes, properties files, spring configs, etc. included.

We're on version 6.2.2.

It seems like ES6 has problem loading anonymous inner class (DefaultStatsReceiver in this case). Any suggestion to get around it?

Elastic does not support embedding the server. You should instead launch Elasticsearch using the standard distribution start script and connect to it with the java client.

Can you elaborate? We install elasticsearch via docker and run it as a server. We then install our plugin using the 'bin/elasticsearch-plugin install' command. The plugin, which connects to our existing services, goes through all the ES security and bootstrap checks.

How should we do it differently?

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