From 4c0b7b36e40930b41cec398a25a71e81676fb3ae Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Thu, 25 Aug 2022 16:05:15 +0800 Subject: [PATCH] support higher version of JDK to attach lower version of JDK. #2249 --- core/src/main/java/com/taobao/arthas/core/Arthas.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/java/com/taobao/arthas/core/Arthas.java b/core/src/main/java/com/taobao/arthas/core/Arthas.java index 0709e35ec..5b6d14cfc 100644 --- a/core/src/main/java/com/taobao/arthas/core/Arthas.java +++ b/core/src/main/java/com/taobao/arthas/core/Arthas.java @@ -130,6 +130,16 @@ public class Arthas { } else { throw e; } + } catch (com.sun.tools.attach.AgentLoadException ex) { + if ("0".equals(ex.getMessage())) { + // https://stackoverflow.com/a/54454418 + AnsiLog.warn(ex); + AnsiLog.warn("It seems to use the higher version of JDK to attach the lower version of JDK."); + AnsiLog.warn( + "This error message can be ignored, the attach may have been successful, and it will still try to connect."); + } else { + throw ex; + } } } finally { if (null != virtualMachine) {