Arthas启动失败 报 A JNI error has occurred, please check your installation and try again
- Dominant language
- Java
- Stars
- 37.5k
- Forks
- 7.6k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 4
Description
- [x] 我已经在 [issues](https://github.com/alibaba/arthas/issues) 里搜索,没有重复的issue。
### 环境信息
* `arthas-boot.jar` 或者 `as.sh` 的版本: 3.7.2
* Arthas 版本: 3.7.2
* 操作系统版本: Windows10
* 目标进程的JVM版本: xxx
* 执行`arthas-boot`的版本: 3.7.2
### 重现问题的步骤
1. 创建目录 cmd 启动idea curl -O https://arthas.aliyun.com/arthas-boot.jar java -jar arthas-boot.jar
2. 报错
### 期望的结果
正常启动
### 实际运行的结果
报错
把异常信息贴到这里
E:\installment>java -jar arthas-boot.jar
[INFO] JAVA_HOME: E:\Idea_JDK\jdk11
[INFO] arthas-boot version: 3.7.2
[INFO] Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER.
* [1]: 4500 math-game.jar
[2]: 1112
1
[INFO] Start download arthas from remote server: https://arthas.aliyun.com/download/3.7.2?mirror=aliyun
[INFO] File size: 17.84 MB, downloaded size: 13.21 MB, downloading ...
[INFO] Download arthas success.
[INFO] arthas home: C:\Users\Admin\.arthas\lib\3.7.2\arthas
[INFO] Try to attach process 4500
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/attach/AgentLoadException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AgentLoadException
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 7 more
[ERROR] attach fail, targetPid: 4500
备注:java的版本和javac的版本一致
E:\installment>java -version
java version "11.0.13" 2021-10-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.13+10-LTS-370)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.13+10-LTS-370, mixed mode)
E:\installment>javac -version
javac 11.0.13
Contributor guide
Research direction
Reproduce the failure with arthas-boot.jar 3.7.2 on Windows 10 using Java 11, following the command and target process details in the report. Start by investigating the attach failure and missing com.sun.tools.attach.AgentLoadException; done means Arthas can attach to the selected process without the JNI or ClassNotFoundException errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100