Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无名用户运行Arthas无法搜索到Java应用 #2996

Open
1 task done
CeerDecy opened this issue Feb 28, 2025 · 1 comment
Open
1 task done

无名用户运行Arthas无法搜索到Java应用 #2996

CeerDecy opened this issue Feb 28, 2025 · 1 comment

Comments

@CeerDecy
Copy link

  • 我已经在 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

重现问题的步骤

  1. 以用户ID为1001,GroupID为1001,启动了一个java程序的容器,这个镜像里没有创建过ID为1001的用户
    securityContext:
      runAsGroup: 1001
      runAsUser: 1001
  1. 执行arthas无法找到我运行中的java程序,但查看ps -ef确实是在运行中的
    Image

但如果这个用户创建过则可以正常执行(这个用户没有root权限):
Image

期望的结果

我希望在 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.
@sheikmca
Copy link

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:

  1. Java Process is Not Running
    ✅ Solution: Run the command:
    jps -l
    If no Java process appears, start your Java application first.
  2. jps Command Not Found
    ✅ Solution: Check if Java is installed and properly set up. Run:
    java -version
    If Java is not installed, install it.
  3. 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
  4. 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
  5. 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
  6. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants