spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.55k stars 40.55k forks source link

SpringBoot 3.1/3.2 issue with ElasticSearch #42150

Closed ackjui closed 2 weeks ago

ackjui commented 2 weeks ago

Currently the sprinboot app is running with starter version 2.17.17 and with below elasticsearch version :

org.springframework.boot spring-boot-starter-data-elasticsearch

Now, After upgrading to 3.1.0/3.2.0, after trying both I'm getting below error deploying and running app on the server :

Error creating bean with name 'storeDetailsRepo' defined in com.xyz.abc.communication.elk.repository.ElkStoreDetailsRepo defined in @EnableElasticsearchRepositories declared on ElasticsearchRepositoriesRegistrar.EnableElasticsearchRepositoriesConfiguration: Cannot resolve reference to bean 'elasticsearchTemplate' while setting bean property 'elasticsearchOperations'
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'elasticsearchTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataConfiguration$JavaClientConfiguration.class]: Unsatisfied dependency expressed through method 'elasticsearchTemplate' parameter 0: Error creating bean with name 'elasticsearchClient' defined in class path resource [org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchClientConfigurations$ElasticsearchClientConfiguration.class]: Unsatisfied dependency expressed through method 'elasticsearchClient' parameter 0: Error creating bean with name 'restClientTransport' defined in class path resource [org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchClientConfigurations$ElasticsearchTransportConfiguration.class]: Signature Parse error: expected a class type

Maven dependency tree :

org.springframework.boot:spring-boot-starter-data-elasticsearch:jar:3.1.0:compile
[INFO]    \- org.springframework.data:spring-data-elasticsearch:jar:5.1.0:compile
[INFO]       \- co.elastic.clients:elasticsearch-java:jar:8.7.1:compile

I'm stuck due to this error. Need help in understanding it. Note : On local machine the app is running fine with 3.1/3.2 boot version while connecting to same elasticsearch cluster.

wilkinsona commented 2 weeks ago

Are you using New Relic, or a similar instrumentation-based agent on the server? This looks a lot like https://github.com/newrelic/newrelic-java-agent/issues/539.

ackjui commented 2 weeks ago

Yes, I'm using New Relic. I was using newRelic with Java17 already but with springBoot 2.7.17. The issue is only happening when upgrading to 3.x springboot.

Unsatisfied dependency expressed through method 'elasticsearchClient' parameter 0: Error creating bean with name 'restClientTransport' defined in class path resource [org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchClientConfigurations$ElasticsearchTransportConfiguration.class]: Signature Parse error: expected a class type

ackjui commented 2 weeks ago

And in this : https://github.com/newrelic/newrelic-java-agent/issues/539 . It's mentioned the issue is fixed in 17.0.5. And I'm using 17.0.12.

ackjui commented 2 weeks ago

But still I'm trying the workaround mentioned and will update :

class_transformer:
    com.newrelic.instrumentation.java.completable-future-jdk8u40:
      enabled: false
ackjui commented 2 weeks ago

It's exact same error if after applying the workaround.

wilkinsona commented 2 weeks ago

Thanks for confirming you're using New Relic in the environment where the problem occurs. While this may not be https://github.com/newrelic/newrelic-java-agent/issues/539 specifically, all the evidence thus far suggests that it is a New Relic problem. I'm going to close this one as I don't think there's anything we can do to help and this should be investigated on the New Relic side of things.

If you can reproduce the problem without New Relic then please comment here with a minimal sample that does so and we can re-open the issue and take another look.