How to use ESIntegTestCase in elasticsearch 5.6.3

When I run the source code:

public class Mytests extends ESIntegTestCase {

  protected Settings nodeSettings(int nodeOrdinal) {
      return Settings.builder().put(super.nodeSettings(nodeOrdinal))
             .put("node.mode", "network")


I get an error:

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.test.ESTestCase
	Suppressed: java.lang.IllegalStateException: No context information for thread: Thread[id=12, name=Thread-1, state=RUNNABLE, group=TGRP-Mytests]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @AfterClass boundary (for example, static test class initializers are not permitted to access random contexts).
		at com.carrotsearch.randomizedtesting.RandomizedContext.context(
		at com.carrotsearch.randomizedtesting.RandomizedContext.current(
		at com.carrotsearch.randomizedtesting.RandomizedRunner.augmentStackTrace(
		at com.carrotsearch.randomizedtesting.RunnerThreadGroup.uncaughtException(
		at java.lang.Thread.dispatchUncaughtException(

How to fix this error?

It’s written in the message.

Add Log4J2

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