Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if someone uses Java 17 to run their app and does add this export? Will the agent break their app or throw errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As exceptions, that are thrown from plugins, are caught/handled by ByteBuddy/the agent, I assume the plugin won't work, but the rest of the app work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true but these exceptions still affect the application - more overhead due to creation and logging and the logs are going to be spammed, too.
Just disabling the module on Java 17 is probably also not the best option as even Java 11 can be configured to enforce the module boundaries instead of warning about them.
I think we'll probably have to remove the LDAP plugin until we have found a solution for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will create an external plugin in the mean time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you taking care of the removal or should I?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
classLoaderCanLoadClass("com.sun.jndi.ldap.Connection")seems to work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work in the sense that it returns
falseon Java 17 without--add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMEDbuttruewith that flag?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm it doesn't work with
--add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMED.But
works with
--add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMEDand "only" logs one exception without--add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMEDThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The downside of that is that this eagerly links
com.sun.jndi.ldap.LdapResultand initializes a bunch of classes that otherwise would not be initialized at this point. We usually try not to impact the order in which classes are loaded as this can negatively impact the application. For example, if java.util.logging is used somewhere in the prematurely initialized classes, app server can't set up their custom log handlers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is true.