Elastic Junit and integration test classes does not run after 2.3.5 upgrade

Hi,

I upgraded to ES 2.3.5 and changed my pom.xml accordingly, but i'm getting an exception (see below) which happens for all Elastic related class tests.

Exception :

août 18, 2016 3:48:23 PM com.carrotsearch.randomizedtesting.RandomizedRunner$QueueUncaughtExceptionsHandler uncaughtException
AVERTISSEMENT: Uncaught exception in thread: Thread[SUITE-ElasticUpdateTest-seed#[690F6B4815D7B165],5,TGRP-ElasticUpdateTest]
java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.Strings
	at __randomizedtesting.SeedInfo.seed([690F6B4815D7B165]:0)
	at org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter$MavenMessageBuilder.appendOpt(ReproduceInfoPrinter.java:175)
	at com.carrotsearch.randomizedtesting.ReproduceErrorMessageBuilder.appendAllOpts(ReproduceErrorMessageBuilder.java:42)
	at org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter$MavenMessageBuilder.appendAllOpts(ReproduceInfoPrinter.java:122)
	at org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter.testFailure(ReproduceInfoPrinter.java:89)
	at org.junit.runner.notification.SynchronizedRunListener.testFailure(SynchronizedRunListener.java:63)
	at org.junit.runner.notification.RunNotifier$4.notifyListener(RunNotifier.java:142)
	at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
	at org.junit.runner.notification.RunNotifier.fireTestFailures(RunNotifier.java:138)
	at org.junit.runner.notification.RunNotifier.fireTestFailure(RunNotifier.java:132)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:594)

Here is my pom.xml :

<properties>
                 <es.version>2.3.5</es.version>
		<randomizedtesting-runner.version>2.3.2</randomizedtesting-runner.version>
		<lucene.version>5.5.0</lucene.version>
		<hamcrest.version>1.3</hamcrest.version>
		<junit.version>4.11</junit.version>
</properties> 



<dependencies>
<dependency>
			<groupId>com.carrotsearch.randomizedtesting</groupId>
			<artifactId>randomizedtesting-runner</artifactId>
			<version>${randomizedtesting-runner.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
			<version>${junit.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.lucene</groupId>
			<artifactId>lucene-core</artifactId>
			<version>${lucene.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.lucene</groupId>
			<artifactId>lucene-test-framework</artifactId>
			<version>${lucene.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.elasticsearch</groupId>
			<artifactId>elasticsearch</artifactId>
			<type>test-jar</type>
			<version>${es.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest-core</artifactId>
			<version>${hamcrest.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest-library</artifactId>
			<version>${hamcrest.version}</version>
			<scope>test</scope>
		</dependency>
</dependencies>

Do you have any idea why I am getting this exception ? I tried cleaning the mvn repository but it did not work.
Thank you for your help.

The message complains about org.elasticsearch.common.Strings, can you check whether it is actually included in the jars? (using jar -tvf for instance)

Thank you for your answer.
Yes the jar contains the org.elasticsearch.common.Strings class at the corresponding path.
I tried modifying the versions of the different dependencies on my pom.xml and still no result.

Would you be able to reproduce this issue in a minimal Maven project so that I can look into it?

What do you mean by minimal ? I think that My project is a minimal one :confused:
I'am not using any exotic dependency or jar.
Thank you for your time.

Yes that's perfect, but I meant a complete one including a test file in addition to the pom.xml so that I can be sure to replicate the same problem as you have.

Thank you for answering.

I am Not sure to understand...
Though, here is a test class I am using and that fails with the exception mentioned above :

public class ElasticDeleteTest extends AbstractElasticsearchUnitTest {

   private ElasticDeleter elasticDelete;

   private void initElasticDelete() throws Exception {

      this.elasticDelete = new ElasticDeleter() {
         @Override
         public <ConsumerInputType> void notifyConsumers(ConsumerInputType data) throws Exception {
            // do nothing
         }
      };
      this.elasticDelete.setEsClient(this.getEmbeddedElasticsearchServer());
      // clear all index
      this.getEmbeddedElasticsearchServer().clearAllIndex();
   }

   @Test
   public void testDelete() throws Exception {
      this.initElasticDelete();
      IndexRequestBuilder indexRequest = this.getClient().prepareIndex(ElasticConsts.INDEX_FAMILY, ElasticConsts.FAMILY_TYPE, ElasticTestData.FAN_TEST).setSource(ElasticTestData.FAMILY_JSON_TEST);
      indexRequest.setRefresh(true).execute().actionGet();

      long newCount = this.getEsHelper().count(ElasticConsts.INDEX_FAMILY, ElasticConsts.FAMILY_TYPE);

      SearchResponse response = this.getEsHelper().testSearch(ElasticConsts.INDEX_FAMILY, ElasticConsts.FAMILY_TYPE, ElasticConsts.FAN_FIELD, ElasticTestData.FAN_TEST);
      long hit = response.getHits().getTotalHits();

      DocumentEntry docToDelete = new DocumentEntry(ElasticConsts.FAMILY_TYPE, ElasticTestData.FAN_TEST);

      this.elasticDelete.doTask(docToDelete);

      this.getClient().admin().indices().refresh(new RefreshRequest(ElasticConsts.INDEX_FAMILY)).actionGet();

      response = this.getEsHelper().search(ElasticConsts.INDEX_FAMILY, ElasticConsts.FAMILY_TYPE, ElasticConsts.FAN_FIELD, ElasticTestData.FAN_TEST);
      hit = response.getHits().getTotalHits();

      Assert.assertEquals(0, hit);

   }

}

The ElasticDeleter basically calls client.prepareDelete(index, type, id).setConsistencyLevel(this.consistencyLevel).execute().get();

He meant that you publish your code on GitHub so he can run:

git clone ...
cd ...
mvn test

And reproduce your issue.