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

AbstractContextSource cannot be instantiated on JDK16+ #570

Closed
dreis2211 opened this issue Feb 10, 2021 · 3 comments
Closed

AbstractContextSource cannot be instantiated on JDK16+ #570

dreis2211 opened this issue Feb 10, 2021 · 3 comments
Assignees
Labels
in: build status: duplicate A duplicate of another issue

Comments

@dreis2211
Copy link

Hi,

I'm currently working on JDK 16 support for Spring Boot (see spring-projects/spring-boot#24402) and noticed that AbstractContextSource cannot be instantiated as of JDK16+ anymore.

I guess this is related to the new strong encapsulation being enabled by default (see https://openjdk.java.net/jeps/396).

I can currently workaround this by passing --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED but users would have the same problem again.

Cheers,
Christoph

@dreis2211
Copy link
Author

The only actual usage inside the library itself seems to be the following:

env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory.getName());

One idea would be to deprecate setContextFactory(Class) & getContextFactory() in favor of setContextFactoryName(String) & getContextFactoryName() and a new field contextFactoryName that is instantianted with com.sun.jndi.ldap.LdapCtxFactory instead of referencing the class.

What do you think?

@dreis2211
Copy link
Author

Alternatively, #568 should also work.

@jzheaux
Copy link
Contributor

jzheaux commented Feb 23, 2021

Thanks, @dreis2211! I believe you are correct that #568 will take care of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: build status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants