zoukankan      html  css  js  c++  java
  • 使用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/

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

  • 相关阅读:
    tabhost中setup()和setup(LocalActivityManager activityGroup)
    android自定义TabWidget
    Android使用Fragment来实现TabHost的功能(解决切换Fragment状态不保存)以及各个Fragment之间的通信
    底部菜单栏(三)Fragment+FragmentTabHost实现仿新浪微博底部菜单栏
    TabHost 两种使用方法 直接让一个Activity 继承TabActivity 和 利用findViwById()方法取得TagHost组件
    android的消息处理机制(图+源码分析)——Looper,Handler,Message
    Java高级--Java线程运行栈信息的获取 getStackTrace()
    Java中的守护线程 & 非守护线程(简介)
    Fragment之间的通信
    CString——Left、Right、Find、ReverseFind
  • 原文地址:https://www.cnblogs.com/eeexu123/p/13690389.html
Copyright © 2011-2022 走看看