Getting this error java.lang.ClassNotFoundException: jakarta.json.JsonException

Failed to instantiate [co.elastic.clients.Elasticsearch.ElasticsearchClient]: Factory method 'client' threw exception; nested exception is java.lang.NoClassDefFoundError: jakarta/json/JsonException

@Bean
public ElasticsearchClient client() throws Exception {
RestClient restClient = RestClient.builder(
new HttpHost(esHost, esPort)).build();

   // Create the transport with a Jackson mapper
    ElasticsearchTransport transport = new RestClientTransport(
            restClient, new JacksonJsonpMapper());

    // And create the API client
    return new ElasticsearchClient(transport);
}

Dependency:

org.springframework.boot spring-boot-starter-web 2.6.7
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-jpa</artifactId>
		<version>2.6.7</version>
	</dependency>
	<dependency>
		<groupId>mysql</groupId>
		<artifactId>mysql-connector-java</artifactId>
		<version>8.0.29</version>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-redis</artifactId>
		<version>2.6.7</version>
	</dependency>
	<dependency>
		<groupId>redis.clients</groupId>
		<artifactId>jedis</artifactId>
		<version>4.2.3</version>
	</dependency>

	<dependency>
		<groupId>com.paytm</groupId>
		<artifactId>ncmc-acquirer-bus-common</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<version>2.6.7</version>
		<scope>test</scope>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
	<dependency>
		<groupId>org.mockito</groupId>
		<artifactId>mockito-all</artifactId>
		<version>1.10.19</version>
		<scope>test</scope>
	</dependency>

	<dependency>
		<groupId>junit</groupId>
		<artifactId>junit</artifactId>
		<version>4.13.2</version>
		<scope>test</scope>
	</dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
		<version>1.18.24</version>
	</dependency>

	<!-- ES DEPENDENCY -->
	<dependency>
		<groupId>co.elastic.clients</groupId>
		<artifactId>elasticsearch-java</artifactId>
		<version>8.1.3</version>
	</dependency>

	<dependency>
		<groupId>com.fasterxml.jackson.core</groupId>
		<artifactId>jackson-databind</artifactId>
		<version>2.12.3</version>
	</dependency>

	<dependency>
		<groupId>jakarta.json</groupId>
		<artifactId>jakarta.json-api</artifactId>
		<version>2.0.1</version>
	</dependency>


</dependencies>

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