Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP error with JDK 17, JDK 18 #47

Open
kasemir opened this issue Apr 18, 2022 · 1 comment
Open

LDAP error with JDK 17, JDK 18 #47

kasemir opened this issue Apr 18, 2022 · 1 comment
Labels
faq A frequent question or useful note

Comments

@kasemir
Copy link

kasemir commented Apr 18, 2022

Channelfinder compiles with JDK 18, but at startup it then fails with this type of error:

IllegalAccessError: class org.springframework.ldap.core.support.AbstractContextSource (in unnamed module ...

Workaround seems to be this:
java --add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMED -jar target/ChannelFinder-4.0.0.jar

@shroffk shroffk added the faq A frequent question or useful note label Apr 27, 2022
@mdavidsaver
Copy link
Contributor

mdavidsaver commented Apr 27, 2022

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ldapContextSource' defined in class path resource [org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.ldap.core.support.LdapContextSource]: Factory method 'ldapContextSource' threw exception; nested exception is java.lang.IllegalAccessError: class org.springframework.ldap.core.support.AbstractContextSource (in unnamed module @0x22f71333) 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

For those searching, here is a longer excerpt of this really long error message as seen with openjdk 17.0.2 (Debian 11).

--add-exports seems to do the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq A frequent question or useful note
Projects
None yet
Development

No branches or pull requests

3 participants