Elasticsearch 7.7.1 ServiceConfigurationError Cannot instantiate FastCompressingCodec

I am trying to run a test by extending ESSingleNodeTestCase with elasticsearch 7.7.1. But I am getting the below error. I am not seeing any jar hell error and I have made the intellij settings as mentioned here

java.util.ServiceConfigurationError: Cannot instantiate SPI class: org.apache.lucene.codecs.compressing.FastCompressingCodec

	at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:82)
	at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:51)
	at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:38)
	at org.apache.lucene.codecs.Codec$Holder.<clinit>(Codec.java:47)
	at org.apache.lucene.codecs.Codec.getDefault(Codec.java:143)
	at org.apache.lucene.util.TestRuleSetupAndRestoreClassEnv.before(TestRuleSetupAndRestoreClassEnv.java:142)
	at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:44)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
	at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
	at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
	at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: blockSize must be in 2-22, got 1024
	at org.apache.lucene.codecs.compressing.CompressingStoredFieldsFormat.<init>(CompressingStoredFieldsFormat.java:114)
	at org.apache.lucene.codecs.compressing.CompressingCodec.<init>(CompressingCodec.java:96)
	at org.apache.lucene.codecs.compressing.FastCompressingCodec.<init>(FastCompressingCodec.java:24)
	at org.apache.lucene.codecs.compressing.FastCompressingCodec.<init>(FastCompressingCodec.java:31)
	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 java.lang.Class.newInstance(Class.java:442)
	at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:72)
	... 20 more

And then

REPRODUCE WITH: ./gradlew 'null' --tests "com.vnera.query.runner.MyTest" -Dtests.seed=5351B8690E63EDD8 -Dtests.locale=en-IN -Dtests.timezone=Asia/Kolkata
NOTE: Mac OS X 10.15.6 x86_64/Azul Systems, Inc. 1.8.0_242 (64-bit)/cpus=8,threads=1,free=237421568,total=324534272

java.lang.NullPointerException
	at java.util.Objects.requireNonNull(Objects.java:203)
	at org.apache.lucene.codecs.Codec.setDefault(Codec.java:154)
	at org.apache.lucene.util.TestRuleSetupAndRestoreClassEnv.after(TestRuleSetupAndRestoreClassEnv.java:279)
	at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:51)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
	at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
	at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
	at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at java.lang.Thread.run(Thread.java:748)

Can someone let me know what could be causing this and how can I get around this?

The problem was because I was using a different version of elasticsearch-test framework and elasticsearch

<dependency>
       <groupId>org.elasticsearch.test</groupId>
       <artifactId>framework</artifactId>
       <version>7.6.0</version>
       <scope>test</scope>
</dependency>

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

The issue is resolved by making org.elasticsearch.test:framework also as 7.7.1

1 Like

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