I'm currently trying to do a migration of a project from Java 8 to Java 17 and Spring Boot 2.7 to 3.1.
I've encountered dependencies on javax.servlet package in latest Apache Struts 2 Core (6.2.0).
I wonder if I can somehow make the project work on JVM 17?
I tried compiling the project, but with no success - the compiler says cannot access javax.servlet.*
The
cannot access javax.servlet.*error is NOT caused by using Java 11 / 17.It is happening because when you switched to Spring Boot 3.1 you have (implicitly) switched from the Java EE specs to Jakarta EE 9. The
javax.servlet.*packages have been renamed tojakarta.servlet.*(There are various tools and guides to help you migrate plain servlet code from Java EE to Jakarta EE, but I don't think this will help you.)Struts 2 is also affected (afflicted) by the Java EE -> Jakarta EE issue. Unfortunately Struts 6.x does NOT support Jakarta EE 9. According to Struts issue WW-5141, the Struts team is targeting support for Jakarta EE 9 in the 7.0.0 milestone.
In summary: