I am using spring boot 2.1.5 and spring-kafka, version not specified. Project is gradle 6.0, java 1.8
I am getting this error
error creating bean with name 'org.springframework.boot.autoconfigure.kafka.kafkaannotationdrivenconfiguration': unexpected exception during bean creation; nested exception is java.lang.typenotpresentexception: type org.springframework.kafka.listener.recordinterceptor not present
What could be this due to? Please help.
2.1.5 is nearly a year old; the current Boot 2.1.x release is 2.1.13.
2.1.5 uses spring-kafka 2.2.6 so I don't see how you can get that error, based on your description.
RecordInterceptor was added in spring-kafka 2.2.7.
It was added to the Spring Boot autoconfiguration in 2.2.0.
So what you are describing makes no sense; you must be using Boot 2.2.x and an old spring-kafka version.
You have mis-matched Boot/Kafka versions.
Upgrade to Boot 2.1.13 (or preferably 2.2.6).
Related
I am trying to upgrade my existing spring boot 2.7.x project to spring boot 3.x.x.
I have sorted out everything except this error while running the application.
APPLICATION FAILED TO START
Description:
Parameter 0 of method lockProvider in com.cox.config.ShedLockConfiguration required a bean of type 'org.elasticsearch.client.RestHighLevelClient' that could not be found.
Action:
Consider defining a bean of type 'org.elasticsearch.client.RestHighLevelClient' in your configuration.
Process finished with exit code 0
Spring Boot Version used is 3.0.0
I am aware that RestHighLevelClient is deprecated, but documentation says it's still available in spring-data-elasticsearch
Tried upgrading all dependencies to be compatible with spring boot 3
Update:
Also getting below error for another component with elastic search which I am trying to upgrade to spring boot 3
APPLICATION FAILED TO START
Description:
Parameter 2 of constructor in com.cox.service.esindex.EsIndexRefreshService required a bean of type 'org.springframework.data.elasticsearch.core.ElasticsearchOperations' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.data.elasticsearch.core.ElasticsearchOperations' in your configuration.
It looks like spring boot is no longer creating beans for deprecated methods/classes. Can you please help me map each deprecated method/class with the new spring-data-elasticsearch
The documentation explicitly states:
The old deprecated RestHighLevelClient can still be used, but you will need to add the dependency explicitly to your application as Spring Data Elasticsearch does not pull it in automatically anymore:
Edit 18.02.2023:
Check the documentation it also documents how to configure the different clients. You will have to do this configuraiton by yourself, I don't think that Spring Boot will configure this automatically, they are using the current stuff from Spring Data Elasticsearch .
I am working on spring-boot upgrade from 2.2.2.Release to 2.7.6. I am noticing org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration is not available in spring-boot-autoconfigure:2.7.6. Is there any substitute for ElasticsearchAutoConfiguration class which is introduced in 2.7.6 version.
I checked the spring boot project source code but didn't find the ElasticsearchAutoConfiguration class present in latest version
It looks like the org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration class was removed in favor of ElasticsearchDataAutoConfiguration in the same package in b780e52 since Spring Boot 2.3.0.
See also https://github.com/spring-projects/spring-boot/issues/19668.
I am trying to use Hibernate Core 6.x with Spring Boot / Spring Data JPA 2.7.x project, but it's not able to pick up Hibernate 6.x classes.
As you can see in the pom, in spring-boot-starter-data-jpa I have excluded hibernate-core 5.6.10-final and added 6.x as project dependency.
But I am seeing below error:
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'javax.persistence.EntityManagerFactory' that could not be found.
Action:
Consider defining a bean of type 'javax.persistence.EntityManagerFactory' in your configuration.
I don't think spring boot is autoconfiguring the new Hibernate 6.x version.
For 5.6.x, I could see below 11 implementations for EntityManager.
On moving to 6.x, I see only one implementation.
What's going on, I have no idea. Can some one pitch in and help resolve this issue.
Why I want 6.x -> See if RIGHT JOIN work in 6.x. Even other wise I see it's going to be a good task to figure out and make this combo work.
Hibernate 6 uses the JPA version (JPA 3) that uses the jakarta.persistence package names introduced in JakartaEE 9. Spring Boot 2.x still uses the javax.* package namespace of JakartaEE 8 and earlier (JPA 2.2 and earlier), and thus only supports Hibernate 5.x (for Spring Boot 2.7, Hibernate 5.6.x is the default).
Spring Boot 3 switched to the jakarta.* packages of JakartaEE 9+. So, you can upgrade to Spring Boot 3 to able to use Hibernate 6. If you cannot upgrade Spring Boot yet, you'll need to use Hibernate 5.6.
We have a Spring Boot App packaged as a war file and deployed on Wildfly. When I update the Spring Boot version from 2.5.6 to 2.6.2, I see lots of exception with Spring Autowire of variables. The problems being reported are circular dependency.
Has something changes with new version of Spring that changes how the autowiring works? I tried to research and can find no mention to changes in that area.
Thanks
The thing is that with the new Spring Boot version, circular dependencies are not allowed by default. Check the release notes.
You can get back to the previous behaviour setting the following configuration:
spring.main.allow-circular-references: true
However, I would suggest you revisit the application design.
When i add sleuth dependency in a spring boot project that uses log4j2 for logging, i get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/FilterRegistrationBean
Does sleuth work only with logback and it support log4j2 also ?
the error you are getting is for FilterRegistrationBean, it maybe due to the version mismatch of spring-cloud and spring-boot. There is a issue with compatibility of Spring-boot version 2.x.x and Spring-cloud version 1.x.x
refer to this:
https://github.com/spring-cloud/spring-cloud-config/issues/836#issuecomment-376846920