From notifications-return-121516-archive-asf-public=cust-asf.ponee.io@skywalking.apache.org Thu Jan 28 02:27:53 2021 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-he-de.apache.org (mxout1-he-de.apache.org [95.216.194.37]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 220E9180634 for ; Thu, 28 Jan 2021 03:27:53 +0100 (CET) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-he-de.apache.org (ASF Mail Server at mxout1-he-de.apache.org) with SMTP id 406566402A for ; Thu, 28 Jan 2021 02:27:52 +0000 (UTC) Received: (qmail 45170 invoked by uid 500); 28 Jan 2021 02:27:51 -0000 Mailing-List: contact notifications-help@skywalking.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@skywalking.apache.org Delivered-To: mailing list notifications@skywalking.apache.org Received: (qmail 45160 invoked by uid 99); 28 Jan 2021 02:27:51 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jan 2021 02:27:51 +0000 From: =?utf-8?q?GitBox?= To: notifications@skywalking.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Bskywalking=5D_HendSame_edited_a_comment_on_issue_?= =?utf-8?q?=233661=3A_=22java_-ext=2Edirs=22_is_not_supported?= Message-ID: <161180087144.15632.9680203839447486740.asfpy@gitbox.apache.org> Date: Thu, 28 Jan 2021 02:27:51 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit References: In-Reply-To: HendSame edited a comment on issue #3661: URL: https://github.com/apache/skywalking/issues/3661#issuecomment-768278507 I have a question: Do you have to load the depency libs by "ExtClassLoader"? @jackiepon31 "-Xbootclasspath/a:" can not solve this problem?By the way ,we can use the BootstrapClassLoader to load the them. We can run the oldWay.jar such as: ``` java -javaagent:/{skywalking-agent-dir}/skywalking-agent-abm.jar -Xbootclasspath/a:/{your}.jar -Dskywalking.agent.service_name=serverName -Dskywalking.collector.backend_service=127.0.0.1:11800 Maybe multiple jar in one directory: java -javaagent:/{skywalking-agent-dir}/skywalking-agent-abm.jar -Xbootclasspath/a:/{jar-directory} -Dskywalking.agent.service_name=serverName -Dskywalking.collector.backend_service=127.0.0.1:11800 ``` If don't want to do that like the above Just like @jackiepon31 said: “I suggest to add SkyWalking-agent.jar or its dirs to classpath to make the load mechanism compatible with old packaing way instead of spring-boot fat jar.” by using the BootstrapClassLoader to load the them, rather than the ExtClassLoader ,is OK? @wu-sheng .Because ExtClassLoader can't seem to do it。 We can use "instrumentation.appendToBootstrapClassLoaderSearch(jarFile)": ``` public class SkyWalkingAgent { private static ILog LOGGER = LogManager.getLogger(SkyWalkingAgent.class); public static void premain(String agentArgs, Instrumentation instrumentation) throws PluginException { File basePath = AgentPackagePath.getPath(); File classPathDictionary = new File(basePath, "classpath"); if (classPathDictionary.exists() && classPathDictionary.isDirectory()) { String[] jarFileNames = classPathDictionary.list((dir, name) -> name.endsWith(".jar")); for (String fileName : jarFileNames) { JarFile jarFile = new JarFile(classPathDictionary + "/" + fileName); instrumentation.appendToBootstrapClassLoaderSearch(jarFile); } } //....... } ``` "classpath" is a dictionary that has the jars which need to load to classpath; ``` skywalking -- classpath -- 1.jar -- 2.jar -- skywalking-agent-abm.jar ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org