Cannot create bean because of ThreadPool in test environment

(정문주) #1

Hi, I'm using ThreadPool to use BulkProcessor like this.

final Settings settings = Settings.builder().put(Node.NODE_NAME_SETTING, "high-level-client").build();
final ThreadPool threadPool = new ThreadPool(settings);

//getClient is returning RestHighLevelClient
//listener is BulkProcessor.Listener type

bulkProcessor = new BulkProcessor.Builder(getClient()::bulkAsync, listener, threadPool)


However, If I try to test, there is an exception

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NAME': Invocation of init method failed; nested exception is java.lang.AssertionError
Caused by: java.lang.AssertionError
at org.elasticsearch.threadpool.ThreadPool.<init>(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(

and is

final ThreadPool threadPool = new ThreadPool(settings);

How can I fix this problem?

I'm using Elasticsearch 5.6.12

(David Pilato) #2

I wonder if you have another version of elasticsearch jar somewhere in your classpath...

(system) #3

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