Skip to content

[Rejected] Add support for Java Extension Class Loader. #62

Closed
wu-sheng wants to merge 19 commits into
mainfrom
ext-classloader
Closed

[Rejected] Add support for Java Extension Class Loader. #62
wu-sheng wants to merge 19 commits into
mainfrom
ext-classloader

Conversation

@wu-sheng
Copy link
Copy Markdown
Member

@wu-sheng wu-sheng commented Oct 31, 2021

  • If this is non-trivial feature, paste the links/URLs to the design doc.
  • Update the documentation to include this new feature.
  • Tests(including UT, IT, E2E) are added to verify the new feature.
  • If it's UI related, attach the screenshots below.
  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #[Rejected] "java -ext.dirs" is not supported skywalking#3661.
  • Update the CHANGES log.

To @apache/skywalking-committers

I am planning to bump up the version of Java agent after this gets merged. 9.0.0 would be the next major version to indicate we added Extension ClassLoader support in the core level.
First and most importantly, this credit and contribution belongs to @daimingzhi. I am just finishing this PR with a little conflict resolving, polishing, and fix a little error in the plugin test.

Extension ClassLoader

Extension ClassLoader: The Extension ClassLoader is a child of Bootstrap ClassLoader and loads the extensions of core java classes from the respective JDK Extension library.
It loads files from jre/lib/ext directory or any other directory pointed by the system property java.ext.dirs.
User decides which parts of the service should be loaded by the extension classloader, so, we open plugin.plugins_in_ext_class_loader=${SW_PLUGINS_IN_EXT_CLASS_LOADER:} in the agent.config file.

Through this setting, users declare plugins are for excClassloader. Multiple values should be separated by ",".
Also support wildcard(\*),like ehcache\*.


This PR originally started at #19, @daimingzhi and I have a long discussion about this topic there.

daimingzhi and others added 17 commits September 4, 2021 19:45
adjust pom.xml,add maven-dependency-plugin
* main: (28 commits)
  fix release doc (#61)
  Support Jedis' Transaction and fix duplicated enhancement (#57)
  Initialize 8.9.0 iteration (#59)
  Polish release shell and doc. (#58)
  fix rocketmq message header properties garbled characters issue (#54)
  Fix netty-socketio plugin test failure (#56)
  Add okhttp2.x plugin (#49)
  add e2e test for kafka transporter (#42)
  Fix version badge (#53)
  Add JDK17 supported declaration. (#52)
  Fix instrumentation v2 API doesn't work for constructor instrumentation. (#51)
  Add kylin jdbc plugin (#45)
  Fix version compatibility for JSON-RPC4J Plugin (#50)
  Feature add clickhouse jdbc plugin (#41)
  Update menu.yml (#48)
  Fix format. (#47)
  Add new menu for the document (#46)
  Doc: Update setup agent in kubernetes from 'containers' to 'initContainers'. (#44)
  The httpasyncclient-4.x-plugin does not take effect every time. (#40)
  Add an agent plugin to support Jackson (#39)
  ...

# Conflicts:
#	.github/workflows/plugins-test.3.yaml
#	CHANGES.md
#	docs/en/setup/service-agent/java-agent/README.md
#	docs/menu.yml
@wu-sheng wu-sheng added the core label Oct 31, 2021
@wu-sheng wu-sheng added this to the 9.0.0 milestone Oct 31, 2021
@wu-sheng wu-sheng requested review from dmsolr and kezhenxu94 October 31, 2021 07:41
@wu-sheng
Copy link
Copy Markdown
Member Author

To reviewers(@apache/skywalking-committers), when you merge this, please make sure we have @daimingzhi listed as a co-author of this PR. Because of squash and merge policy, this PR will belong to my account I am afraid. Let's keep the track correctly and respect our contributor.

@wu-sheng
Copy link
Copy Markdown
Member Author

I noticed precious plugin test codes didn't verify this feature. Because Spring classloader includes target jars in the Spring fatjar, which means the httpclient jars are not loaded through ext-classloader.
Let me fix this test case.

@wu-sheng
Copy link
Copy Markdown
Member Author

wu-sheng commented Oct 31, 2021

An update, -Djava.ext.dirs is obsolete. Since JDK9 you will see this

<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; Use -classpath instead.
.Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

@wu-sheng
Copy link
Copy Markdown
Member Author

@daimingzhi According to JDK 11 is widely used and recommended to use. JDK8 would be the only LTS JDK.

JDK8 EOF update

  1. After January of 2019, only customers who have signed a support contract with Oracle will still receive security updates for Oracle JDK 8.
  2. Maintenance for OpenJDK 8 is planned for at least another 4 years, until September 2023. 2 years left for EOL.

So, generally, according to the roadmap of JDK, java.ext.dirs should be replaced by cp or classpath. I will close this PR with original one as well. But I will add a FAQ doc to say what is going on, if user wants to try this draft feature, feel free to download and try.


Same as this reason, I would NOT bump up agent version to v9. Let's stay in v8 for longer.

@wu-sheng wu-sheng closed this Oct 31, 2021
@wu-sheng wu-sheng deleted the ext-classloader branch October 31, 2021 13:09
@wu-sheng wu-sheng changed the title [Agent v9 core] Add support for Java Extension Class Loader. [Rejected] Add support for Java Extension Class Loader. Oct 31, 2021
GuoHaoZai pushed a commit to GuoHaoZai/skywalking-java that referenced this pull request Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants