The Problem
We currently have a Spring MVC application (non-spring-boot) based on Spring 5 and Hibernate 5. We have to migrate the app to Hibernate 6.1.
During testing we are encountering exceptions once upgraded to Hibernate 6.1. The root cause exception
java.lang.NoClassDefFoundError:
Could not initialize class org.springframework.orm.hibernate5.LocalSessionFactoryBuilder
Is Spring 5 compatible with Hibernate 6.1? I checked the Spring.io website but could not find any compatibility information for spring-orm.
What I Expected
I expected the application to work with Hibernate 6.1 upgrade.
Environment
Spring MVC 5.3.21 (non-spring-boot)
Hibernate 6.1.0
Tomcat 9.0.64
Java 13
Ubuntu 20
Research Performed
I checked the spring.io website and reference manual. I could not find compatibility information for spring-orm and Hibernate 6.1
How to Reproduce
Deploy a Spring MVC web app (non-spring-boot) that uses Spring 5.3.21 and Hibernate 6.1
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.
We have a lot of spring code written in our AEM application. We are using spring dm to run the code in osgi.
Now we would like to migrate our code to JDK 11 which requires us to migrate spring framework to 5.1 onwards. Is there a spring dm version with support springframework 5.1 onwards.
Are there any other alternative approaches to do such migration ??
regards,
We are currently using the following frameworks and its versions.
Spring Boot parent - 1.4.5.RELEASE
Vaadin-Bom - 7.7.3
Vaadin Spring Boot Starter - 1.1.0
Vaadin-Spring - 1.1.0
Planning to upgrade the spring boot parent version. But i'm sure if we upgrade the spring boot parent version, then need to upgrade the Vaadin dependencies.
I spent few days to find the latest Vaadin frameworks compatibility with the
Spring Boot jars. But couldn't able to arrive at solution. Could you please share your suggestions.
Thanks in Advance!!!
Since Vaadin 7 end-of-life happened already I would suggest migrating to Vaadin 8. You can check the versions in Vaadin 8 full stack app starter with Spring
I was creating spring-boot project with Activiti.
I noticed that Activiti option is now missing from https://start.spring.io/
for both 1.5.18 and 2.1.1 versions of spring boot.
The Activiti 7 is under development (beta available) with examples on spring-boot 2.x
Can I use Activiti 7 with spring-boot 1.5.18?
For spring boot 1.x you are probably safest to use Activiti 6 as Activiti 7 is being built for spring boot 2.x. But if you're especially interested in Activiti 7 then please feel free to ask on the Activiti 7 gitter chat and discuss your use case with the development team and the community there.
I have developed some rest services with Spring mvc 3.0.9. In some case I have an exception. It depends that my spring version use Servlet 3.0 api (my application server is jboss eap 5.1). What is latest spring mvc version compatible with Servlet 2.5? Thanks.
Spring 3.2 should work with Servlet 2.5 API.
Only Spring 4.0 requires Serlvet 3.0:
refer this official documentation for more info.
3 New Features and Enhancements in Spring Framework 4.0)
3.4 Java EE 6 and 7
Java EE version 6 or above is now considered the baseline for Spring
Framework 4, with the JPA 2.0 and Servlet 3.0 specifications being of
particular relevance.
Spring 4.0 work with Servlet 2.5.
See document: (https://docs.spring.io/spring/docs/4.3.14.RELEASE/spring-framework-reference/htmlsingle/)
3.4 Java EE 6 and 7
Java EE version 6 or above is now considered the baseline for Spring
Framework 4, with the JPA 2.0 and Servlet 3.0 specifications being of
particular relevance. In order to remain compatible with Google App
Engine and older application servers, it is possible to deploy a
Spring 4 application into a Servlet 2.5 environment. However, Servlet
3.0+ is strongly recommended and a prerequisite in Spring’s test and mock packages for test setups in development environments.
3.7 General Web Improvements
Deployment to Servlet 2.5 servers remains an option, but Spring
Framework 4.0 is now focused primarily on Servlet 3.0+ environments.
If you are using the Spring MVC Test Framework you will need to ensure
that a Servlet 3.0 compatible JAR is in your test classpath.