Error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elasticsearchClient' defined in class path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method 'elasticsearchClient' threw exception; nested exception is java.lang.IllegalStateException: availableProcessors is already set to [4], rejecting [4]
The solution to this problem encountered by the springboot startup class:
@SpringBootApplication
public class Application{
public static void main(String[] args) {
System.setProperty("es.set.netty.runtime.available.processors","false");
SpringApplication.run(Application.class, args);
}
}
The solution to this problem in unit testing:
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
public class ESTest {
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
public ESTest(){
// Add this line of code to the test class constructor
System.setProperty("es.set.netty.runtime.available.processors","false");
}
@Test
public void testCreateIndex() {
elasticsearchTemplate.createIndex(Users.class);
}
}
Read More:
- SpringBoot Integrating elasticsearch Error: Error creating bean with name ‘restHighLevelClient‘
- [Solved] SpringBoot Integrate ES Error: Elasticsearch health check failed
- Springboot2.6.X configurate swagger error [How to Solve]
- Springboot2.6X version integrate knife4j error [How to Solve]
- Springboot startup error: err config is disabled command (Redis Disables Config command)
- When the database table field is set to self incrementing, use the entity class to insert or update the data to solve the error (Hibernate Framework)
- Mongodb java version 3.X, prompt “XXX (an encryption algorithm) is not available” when there is a user name and password
- [Solved] SpringBoot Microservices: Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded dat
- Springboot controls the startup of rabbitmq through configuration files
- [How to Fix]java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x98\x82\xF0\x9F…’
- springboot Integrate mybatis Error: Error creating bean with name ‘deptController‘: Unsatisfied dependency expresse
- [Solved] Error installing MVN: Java_Home is set to an invalid directory
- Problems in springboot upgrade 2.4.0: when allowcredentials is true, allowedorigins cannot contain the specia
- [Solved] Springboot Error: Error creating bean with name ‘dataSource‘ defined in class path resource
- SpringBoot integrates Es error: Error creating bean with name ‘restHighLevelClient‘ defined in class path resource
- [Solved] SpringBoot Startup Error: org.springframework.beans.factory.UnsatisfiedDependencyException Error creating
- Elasticsearch Startup Error: unable to install syscall filter: java.lang.UnsupportedOperationException: seccomp
- [Solved] Springboot error: Could Not Found xxmapper
- Springboot integration shiro error: UnsatisfiedDependencyException: Error creating bean with name ‘getShiroFilterFact
- Springboot uses Oracle database to report property ‘sqlsessionfactory’ or ‘sqlsessiontemplate’ are required