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

Set context CL for reliable weblogic connection #3870

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SylvainJuge
Copy link
Member

@SylvainJuge SylvainJuge commented Nov 13, 2024

What does this PR do?

Fixes #2409

Weblogic overrides the default HttpURLConnection implementation of the JDK with its own, as a consequence the agent is sometimes unable to connect to the remote server due to classpath issues.

After digging into the WL implementation details, the reason we get a ClassNotFoundException is because the thread context classloader is used to load parts of the SSL/TLS implementation.

When this happens, for example when calling getInputStream() or getStatusCode() on the connection, then we have to make sure the current thread context CL is able to load such classes, which is not the case by default because it's the ShadedClassLoader of the agent which is not aware of the weblogic implementation details that are only visible to WL and not in the bootstrap CL of the JVM.

Luckily, if the thread context CL is set to the same CL as the one that the Weblogic flavor of HttpURLConnection is loaded from, we are able to load the class that was previously not found.

Checklist

  • This is a bugfix

@SylvainJuge SylvainJuge added the ci:agent-integration Enables agent integration tests in build pipeline label Nov 13, 2024
@SylvainJuge SylvainJuge marked this pull request as ready for review November 28, 2024 08:59
Copy link
Contributor

@jackshirazi jackshirazi left a comment

Choose a reason for hiding this comment

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

elegantly done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-java ci:agent-integration Enables agent integration tests in build pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Weblogic exception on agent startup : Class not Found weblogic.security.SSL.jsseadapter.JaSSLContextImpl
2 participants