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

Fix missing class errors #5795

Merged
merged 2 commits into from
Apr 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
*/
public final class AgentTooling {

private static final AgentLocationStrategy LOCATION_STRATEGY =
locationStrategy(getBootstrapProxy());

private static final AgentBuilder.PoolStrategy POOL_STRATEGY =
new AgentCachingPoolStrategy(locationStrategy(getBootstrapProxy()));
new AgentCachingPoolStrategy(LOCATION_STRATEGY);

public static AgentLocationStrategy locationStrategy() {
return locationStrategy(null);
return LOCATION_STRATEGY;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm the fix is to not pass null in this codepath?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The problem is probably that wildfly class loader doesn't unconditionally delegate resource lookups to system loader and isn't able to find resources that are in agent jar. Previously it worked because in AgentLocationStrategy we added ClassFileLocator for all parent class loaders, which included system class loader, where the agent is initially loaded. To make resources from agent jar visible we need to add a ClassFileLocator with bootstrap proxy.

}

public static AgentLocationStrategy locationStrategy(ClassLoader bootstrapProxy) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can remove this method

Expand Down