what is the spring-web module compatible with tomcat 10 - spring

what is the spring-web module version compatible with tomcat 10?
Spring web Application is running on tomcat 9.x and its fail with ClassCastException ad tomcat 10 using jakarta API.
java.lang.ClassCastException: org.springframework.web.filter.DelegatingFilterProxy cannot be cast to jakarta.servlet.Filter

There is none, currently, none of the spring 5 versions support Jakarta packages.
They did say however that in version 6 they will tho, but for now it supports Javax packages.
There might be some workaround, I know I had to test if Spring 4 works with JDK11, it does, but Spring suggests using Spring 5 for JDK11.
For Spring MVC 5, the Spring MVC DispatcherServlet has a dependency on the javax.servlet.* package namespace. This is using the Java EE 8 javax package naming. Since Tomcat 10 is based on Jakarta EE 9, the packages for javax naming are not supported. This explains why Spring MVC 5 does not work on Tomcat 10.
https://github.com/spring-projects/spring-boot/issues/25276

Related

Spring boot 3 and Spring 6 with Tomcat 9

I have not found the answer I want on the web so I've decided to ask it here. Apologize if this breaks any rules, etc.
We're trying to upgrade some of our java applications to spring boot 3 and spring 6. The question is, will these apps still work with Tomcat 9?
These apps are currently running spring boot 2, spring 5 and Tomcat 9.
Based on this, Tomcat 9 won't work with Spring 6. So, moving to spring 6 will requrire going to Tomcat 10.
https://devm.io/spring/spring-framework-6-release
The sixth major version of the Spring Framework has been released,
with Spring Boot 3.0 to follow at the end of November. Spring
Framework 6.0 requires a minimum of JDK 17 at runtime, as well as a
minimum of Tomcat 10/Jetty 11.

Upgrade of tomcat from 9.0.64 to 10.0.22

what come in place of MockHttpServletResponse in servlet 5? This class is not supporting in servlet 5, what is alternative?
Spring 5 is not compatible with Tomcat 10 due to the package renaming from javax to jakarta. The Spring that will work with jakarta package names will be Spring 6.
https://github.com/spring-projects/spring-boot/issues/25276
"This is to be expected. Tomcat 10 is an implementation of the Servlet 5 specification (part of Jakarta EE 9) that renamed all of the packages from javax.servlet to jakarta.servlet. Neither Spring Boot nor Spring Framework supports Jakarta EE 9 at this time. Support is planned, hopefully for Spring Framework 6 and Spring Boot 3, assuming the rest of the ecosystem is ready."
The alternative is to stay on Tomcat 9 until Spring 6 is out.

Is Spring 5 compatible with Hibernate 6.1?

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

Spring mvc compatibile with Servlet 2.5

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.

Spring Boot for older version of java

I am looking to create a new web application using spring boot. Unfortunately my server is fairly locked down in terms of the technology stack. It has java 5 installed on it.
Can anyone tell me whether spring boot can run on java 1.5 and what version?
thanks
Since Spring boot 1.0.0, the minimal requirement to run a Spring boot application has been Java 6. This can also be found in the reference guide of Spring boot 1.0.0:
Spring Boot can be used with “classic” Java development tools or installed as a command line tool. Regardless, you will need Java SDK v1.6 or higher.
Support for older Java versions has been dropped throughout releases, with Spring boot 1.3 moving to Java 7 as a baseline (still possible to use Java 6 with additional configuration) and Spring boot 2.x moving to Java 8 as a baseline. Additionally to what the documentation says, none of the Spring boot 1.x versions support Java 9 or higher.
Summarized:
1.0.0: Support from Java 6 - 8
1.3.0: Support from Java 7 - 8, additional configuration for Java 6 required
2.0.0: Support from Java 8 - ...
So, the answer is that it's not possible to run in Java 5.
For Spring Boot 2.0, the requirement is Java 8 as a minimum version.
From the Spring Boot 2.0 release notes :
Spring Boot 2.0 requires Java 8 as a minimum version. Many existing
APIs have been updated to take advantage of Java 8 features such as:
default methods on interfaces, functional callbacks, and new APIs such
as javax.time. If you are currently using Java 7 or earlier, you’ll
need to upgrade your JDK before you can develop Spring Boot 2.0
applications.

Resources