I tried upgrading a Spring Boot application from spring-data-redis 1.6.4.RELEASE to 1.7.2.RELEASE by adding the spring-data-redis dependency to the POM whilst leaving the spring-boot-starter-redis unchanged (using Spring Boot 1.3.5.RELEASE). The upgraded application fails to start with this error:
Caused by: java.lang.AbstractMethodError: org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(Ljava/lang/reflect/Method;Lorg/springframework/data/repository/core/RepositoryMetadata;Lorg/springframework/data/projection/ProjectionFactory;Lorg/springframework/data/repository/core/NamedQueries;)Lorg/springframework/data/repository/query/RepositoryQuery;
A bit cryptic.
You need to upgrade all of Spring Data, not just Spring Data Redis. By just overriding the version of Spring Data Redis you're left with an incompatible version of Spring Data Commons.
As you are using Spring Boot, you should override the version of the spring-data-releasetrain.version property to Hopper-SR2:
<properties>
<spring-data-releasetrain.version>Hopper-SR2</spring-data-releasetrain.version>
</properties>
and remove the version from any Spring Data-related dependencies you have declared so that Boot's dependency management can keep them all aligned.
Related
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.
I am working ina Hibernate Search application and I am trying to use version 6 (which right now is in beta). I followed all the instructions and documentation in https://docs.jboss.org/hibernate/search/6.0/reference/en-US/html_single/#getting-started-configuration
After trying to start my application I get next error:
I have looked in Google and seems to be I am the first person in the world who is facing this issue.
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmIndexedTypeContext.<init>(HibernateOrmIndexedTypeContext.java:35)
The following method did not exist:
org.hibernate.metamodel.spi.MetamodelImplementor.entity(Ljava/lang/Class;)Lorg/hibernate/metamodel/model/domain/spi/EntityTypeDescriptor;
It was loaded from the following location:
file:/home/myUser/.m2/repository/org/hibernate/hibernate-core/5.3.11.Final/hibernate-core-5.3.11.Final.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.hibernate.metamodel.spi.MetamodelImplementor
Any idea of how to solve it?, In my application I am working with Spring boot and jpa.
As indicated here in the documentation, Hibernate Search 6.0.0.Beta2 requires Hibernate ORM 5.4.7.Final or later. You are using Hibernate ORM 5.3.11.Final.
I think Spring Boot 2.1 ships with ORM 5.3, so that's probably what you're using.
The best course of action would be to upgrade to Spring Boot 2.2.1.RELEASE, which ships with Hibernate ORM 5.4.
If that's not possible, you can still stay with Spring Boot 2.1 and override the version of Hibernate ORM directly in your POM: from what I've seen, it works rather well in Spring Boot 2.1.
Just set this property in your POM:
<properties>
<!-- Override the version of Hibernate ORM in Spring Boot -->
<hibernate.version>5.4.7.Final</hibernate.version>
</properties>
Note that technically, any version after Hibernate ORM 5.4.4.Final should work, but sticking to the version Hibernate Search was tested with is usually safer.
I run spring boot 1.3.3.RELEASE, I have run into this issue that are solved in spring 4.3 https://jira.spring.io/browse/SPR-14114
When does spring boot support spring 4.3 ? Can I upgrade my spring-core dependency in current version of spring boot that I have.
When does spring boot support spring 4.3 ?
Spring Boot 1.4 will use Spring Framework 4.3 by default.
Can I upgrade my spring-core dependency in current version of spring boot that I have.
Yes. Spring Boot 1.3.x uses Spring Framework 4.2.x by default but it is compatible with Spring Framework 4.3.x. Assuming that you are using Maven and spring-boot-starter-parent as your pom's parent, you can use the spring.version property to control the version of Spring Framework that's used. For example:
<properties>
<spring.version>4.3.0.RC1</spring.version>
</properties>
I am currently using mongo-java-driver 3.0.1. I am trying to use Spring Data Mongodb with Spring 3.2.2.RELEASE. Is there any way i can find out which version of Spring Data MongoDB should i use, in order to be compatible with Spring 3.2.2.RELEASE? Some kind of compatibility matrix.
Try define your spring data mongodb dependency at the last of the dependency tree in your pom
You can check the compiled dependencies of Spring Data Mongodb.
Here are the most compatible options for Spring 3.2.2.RELEASE:
spring-data-mongodb 1.5.6.RELEASE depends on spring-core 3.2.22.RELEASE
spring-data-mongodb 1.4.3.RELEASE depends on spring-core 3.2.8.RELEASE
I am trying to port an existing Spring application across to Spring Boot. I am NOT using the spring-boot-starter-data-solr starter however I have apache solrj (5.0.0) on my classpath.
During startup the app blows up. It seems that spring boot sees the solr classes and assumes that I also have spring-boot-starter-data-solr on the classpath. In particular I get this error:
java.lang.IllegalArgumentException: #ConditionalOnMissingBean
annotations must specify at least one bean (type, name or annotation)
If I drop the solrj dependency and use spring-boot-starter-data-solr instead it is ok. However I don't need the spring-data-solr integration and doing so will force me to backport our app to the 4.7.x release of solr.
Is anyone aware of a workaround for this?
So it seems the problem was caused by spring boot's dependency on solrj 4.7.x whereas I am using 5.0.0
I fixed it by using
#SpringBootApplication(exclude = {SolrAutoConfiguration.class})
To tell boot to ignore the SolrAutoConfiguration completely.