• 使用jinfo出现“can't determine target's VM version”问题解决方法


    JINFO命令输出给定的java进程的所有配置信息

    JPS命令是列出当前所有的java进程

    [root@harlan-web ~]# jps
    11204 Bootstrap
    76116 Jps

    查看Bootstrap中的所有配置信息

    [root@harlan-web ~]# jinfo 11204
    Attaching to process ID 11204, please wait...
    Error attaching to process: java.lang.RuntimeException: can't determine target's VM version : field "_reserve_for_allocation_prefetch" not found in type Abstract_VM_Version
    sun.jvm.hotspot.debugger.DebuggerException: java.lang.RuntimeException: can't determine target's VM version : field "_reserve_for_allocation_prefetch" not found in type Abstract_VM_Version
            at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:435)
            at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)
            at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
            at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
            at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
            at sun.jvm.hotspot.tools.JInfo.main(JInfo.java:138)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at sun.tools.jinfo.JInfo.runTool(JInfo.java:108)
            at sun.tools.jinfo.JInfo.main(JInfo.java:76)
    Caused by: java.lang.RuntimeException: can't determine target's VM version : field "_reserve_for_allocation_prefetch" not found in type Abstract_VM_Version
            at sun.jvm.hotspot.runtime.VM.<init>(VM.java:291)
            at sun.jvm.hotspot.runtime.VM.initialize(VM.java:370)
            at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:431)
            ... 11 more

    上述红色的字体提示找不到VM的版本信息。

    查看环境中的JDK版本信息

    查看当前环境的JDK版本,版本为12.0.1

    [root@harlan-web ~]# java -version
    java version "12.0.1" 2019-04-16
    Java(TM) SE Runtime Environment (build 12.0.1+12)
    Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

    查看jinfo所使用的JDK版本,版本为1.8.0

    由至推断,jinfo的JDK的版本与java进程使用JDK版本不一致。 

    解决方法:

    知道了问题所在,使两个版本的JDK进行统一。

    重新将当前环境的JAVA的JDK统一为1.8.0版本

    ln -sf /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/bin/java /etc/alternatives/java
    [root@harlan-web ~]# java -version
    openjdk version "1.8.0_262"
    OpenJDK Runtime Environment (build 1.8.0_262-b10)
    OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)

    然后,再次使用jinfo命令

    [root@harlan-web ~]# jinfo 76529
    Attaching to process ID 76529, please wait...
    Debugger attached successfully.
    Server compiler detected.
    JVM version is 25.262-b10
    Java System Properties:
    
    java.runtime.name = OpenJDK Runtime Environment
    java.vm.version = 25.262-b10
    sun.boot.library.path = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre/lib/amd64
    java.protocol.handler.pkgs = org.apache.catalina.webresources
    shared.loader = 
    java.vendor.url = http://java.oracle.com/

    至此,显示正常,问题解决。

  • 相关阅读:
    python爬虫三大解析库之XPath解析库通俗易懂详讲
    经济学人精读笔记11:你还会逛实体书店吗?
    经济学人精读笔记10:员工休假居然对企业有好处?
    每日一句
    经济学人精读笔记9:打出租out了,“飞的”时代要来了!
    经济学人精读笔记8:企业应该倾听员工的声音
    经济学人精读笔记7:动乱当道,你还想买LV吗?
    经济学人精读笔记6:美团拼多多上市后高歌猛进,逆袭成功
    经济学人精读笔记5:国外枪击事件频发,中国留学生望而生畏
    经济学人精读笔记4:想脱单吗?政府帮你找到另一半!
  • 原文地址:https://www.cnblogs.com/eeexu123/p/13690389.html
Copyright © 2020-2023  润新知