When upgrading to Java 17 and running a spring application that works in Java 8, I get the following exception: (Spring boot 2.2.4.RELEASE)
aused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalAccessError: class org.springframework.ldap.core.support.AbstractContextSource (in unnamed module @0x4abdb505) cannot access class com.sun.jndi.ldap.LdapCtxFactory (in module java.naming) because module java.naming does not export com.sun.jndi.ldap to unnamed module @0x4abdb505
Comment From: wilkinsona
Thanks for the report. Spring Boot 2.2.x does not support Java 17. It has also reached the end of its support period. If you want to use Spring Boot with Java 17, you should upgrade to Spring Boot 2.5.x.
Comment From: bclozel
@geoffritchey this particular issue has been fixed in spring-projects/spring-ldap#579 (Spring LDAP 2.3.4) - as mentioned by Andy, please upgrade to 2.5.x (see spring-projects/spring-boot#26394).