【问题标题】:jps process information unavailable - jconsole and jvisualvm not workingjps 进程信息不可用 - jconsole 和 jvisualvm 不工作
【发布时间】:2011-07-13 09:58:54
【问题描述】:

Windows 更新后,我的 jps、jconsole 和 jvisualvm 不再工作了。

Jps 给了我进程 ID,但它告诉我 process information unavailable

而且我无法像以前那样使用 jvisualvm 连接到这些进程。

我正在运行 1.6.0_22 jre。

我过去已经遇到过这个问题,尝试this trick,它成功了。但这一次,运气不好,没用。

编辑: 我找到了解决方案:在我的临时文件夹中,我确实销毁了 hsperfdata_<username> 文件夹。显然我的用户名有问题。该文件夹名为 hsperfdata_myname。在被 jps 调用销毁并重新创建后,它被称为 hasperfdata_MYNAME。

很奇怪。

【问题讨论】:

    标签: java jconsole


    【解决方案1】:

    在我的临时文件夹中,我确实销毁了 hsperfdata_ 文件夹。显然我的用户名有问题。该文件夹名为 hsperfdata_myname。在被 jps 调用销毁并重新创建后,它被称为 hasperfdata_MYNAME。

    很奇怪。

    【讨论】:

    • 谢谢,谢谢,谢谢,谢谢...我正在拔头发
    【解决方案2】:

    在 unix 上,确保您以启动它的用户身份运行。

    【讨论】:

    • 不错!类似于:sudo -u 用户名 jps
    • 不错的一个!我切换了用户,所有信息都可用了。
    【解决方案3】:

    我们在这里遇到了同样的问题。

    tmp 文件夹技巧对我们也不起作用。

    到目前为止,我们已经找到了一些让事情再次正常运转的方法:

    • 系统还原
    • 重命名“C:\Documents and Settings\myusername\Local Settings”下的临时文件夹并创建一个新的临时文件夹(我不确定这样做是否安全,对于 Windows...)
    • 开始手动从临时文件夹中删除内容
    • 可能是最安全的:运行 ccleaner,这将清理临时文件夹

    【讨论】:

    • 我终于找到了解决办法(见原问题)
    【解决方案4】:

    我编写了一个脚本来应用解决方法,我从我的一些监控脚本中调用它,直到这个问题得到解决。

    #!/bin/bash
    # Name: fix_jps.bash
    # Author: Cameron Pierce
    #
    # Purpose: create /tmp/hsperfdata directories that jps and jstat can work with
    
    ## VARIABLES
    RETVAL=""
    fileHSP=""
    filePID=""
    fileLOG=/tmp/fix_jps.log
    
    # for every /tmp/hsperfdata_[name] directory that exists
    for fileHSP in `ls -d /tmp/hsperfdata_*`; do
            #echo "entry ${fileHSP}" # DEBUG
            # if our search returns entries that are not directories, skip them
            if [ ! -d ${fileHSP} ]; then
                    continue
            fi
            #ls ${fileHSP} # DEBUG
    
            # alternative to ls below
            #FINDFILES=(${fileHSP}/*)
            #if [ ${#FINDFILES[@]} -gt 0 ]; then
            #       echo "files in $fileHSP: ${#FINDFILES[@]} "
            #fi
        for filePID in `ls ${fileHSP}/ 2>> ${fileLOG} | grep "[[:digit:]]\{1,\}"`; do
                #echo "pid name: ${filePID}" # DEBUG
                # if the directory was empty, move on to the next fileENTRY
                if [ "${filePID}" == "" ]; then
                        #echo "the contents of the variable filePID appear to be empty \"${filePID}\"" # DEBUG
                        # remove the fileHSP if empty; this will clean up user hsperfdata dirs
                        rmdir ${fileHSP} 2>> ${fileLOG}
                        continue
                # if a symlink already exists, move on to the next fileENTRY
                elif [ -h /tmp/hsperfdata_${filePID} ]; then
                        #echo "symlink already exists for /tmp/hsperfdata_${filePID}" # DEBUG
                        continue
                fi
                #echo "name: ${filePID}"
                # if a process exists for filePID, create a symlink to the source file
                ps -eo pid | awk '{print $1}' | grep -q "^${filePID}$"
                RETVAL=$?
                # if a process exists with pid of filePID and a symlink doesn't exists, create symlink
                if [ $RETVAL -eq 0 -a ! -e /tmp/hsperfdata_${filePID} ]; then
                        ln -s ${fileHSP}/${filePID} /tmp/hsperfdata_$filePID
                        #echo ls -l /tmp/hs perfdata_${filePID} # DEBUG
                fi
        done
    done
    
    # remove broken symlinks
    #find -L /tmp/hsperfdata_* -type l # DEBUG
    find -L /tmp/hsperfdata_* -type l -delete
    

    【讨论】:

      猜你喜欢
      • 2023-03-07
      • 2015-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多