arthas
arthas copied to clipboard
无名用户运行Arthas无法搜索到Java应用
- [x] 我已经在 issues 里搜索,没有重复的issue。
环境信息
- arthas-boot version: 4.0.4
- java版本: java-1.8.0-openjdk-1.8.0.372.b07-1.el7_9.x86_64
- linux内核: 5.10.134-16.1.al8.x86_64
- Kubernetes版本:v1.30.1
重现问题的步骤
- 以用户ID为1001,GroupID为1001,启动了一个java程序的容器,这个镜像里没有创建过ID为1001的用户
securityContext:
runAsGroup: 1001
runAsUser: 1001
- 执行arthas无法找到我运行中的java程序,但查看
ps -ef确实是在运行中的
但如果这个用户创建过则可以正常执行(这个用户没有root权限):
期望的结果
我希望在 Kubernetes Pod 中设置用户 ID 为 1001 时,能够正常使用 Arthas,尽管容器镜像中并没有为用户 ID 1001 创建相应的用户
实际运行的结果
实际运行结果,最好有详细的日志,异常栈。尽量贴文本。
Can not find java process. Try to run `jps` command lists the instrumented Java HotSpot VMs on the target system.
The error message suggests that the system cannot find a running Java process when you try to attach a monitoring tool, debugger, or profiler Possible Causes and Solutions:
- Java Process is Not Running ✅ Solution: Run the command: jps -l If no Java process appears, start your Java application first.
- jps Command Not Found ✅ Solution: Check if Java is installed and properly set up. Run: java -version If Java is not installed, install it.
- JAVA_HOME is Not Set Correctly ✅ Solution: Set JAVA_HOME and update the system path. For Linux/macOS: export JAVA_HOME=/path/to/java export PATH=$JAVA_HOME/bin:$PATH
- Java is Running as a Different User ✅ Solution: If running Java as a different user (e.g., root), try: sudo jps or switch to the Java process owner
- JDK is Not Installed (Only JRE is Installed) ✅ Solution: jps comes with the JDK, not the JRE. If you only have JRE installed, install the JDK. Check JDK installation: which jps
- jps is Blocked by Security Policies ✅ Solution: Try running: jps -v If permission issues exist, try executing with admin/root privileges. Final Check After applying the solutions, run jps