Java JVMTI不能与-Xdebug -Xrunjdwp一起工作 [英] Java JVMTI doesn't work alongside -Xdebug -Xrunjdwp

查看:991
本文介绍了Java JVMTI不能与-Xdebug -Xrunjdwp一起工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了最后4个小时尝试在必须远程运行的Tomcat实例(即不在
Eclipse中)中设置Eclipse TPTP内存
概要分析。这应该是可以根据TPTP和Agent
控制器文档。

I spent the last 4 hours trying to set up Eclipse TPTP memory profiling on a Tomcat instance that must be run remotely (i.e. not in Eclipse). This should be possible according to the TPTP and Agent Controller docs.

我将TPTP组件(4.6.0)安装到我的Eclipse(Galileo)
工作台,以及代理控制器根据网站上的
指令。要启用代理,我将
以下选项添加到启动Tomcat实例的命令行:

I installed the TPTP components (4.6.0) into my Eclipse (Galileo) workbench, along with the Agent Controller according to the instructions on the website. To enable the agent, I added the following options to the command line that starts the Tomcat instance:

-agentlib:JPIBootLoader=JPIAgent:server=enabled;HeapProf:allocsites=true

,并将以下目录添加到PATH前面:

and added the following directories to the front of the PATH:

D:\dev\tools\ac\plugins\org.eclipse.tptp.javaprofiler
D:\dev\tools\ac\bin

尝试启动Tomcat我一直遇到以下错误
消息:

When attempting to start Tomcat I consistently got the following error message:

ERROR: JDWP unable to get necessary JVMTI capabilities. ["debugInit.c",L279]

我做了很多谷歌搜索,但发现没有任何关联;我尝试
重新安装TPTP和各种版本的代理控制器。

I did a lot of Googling but found nothing relevant; I tried reinstalling TPTP and various versions of the Agent Controller.

最后,问题原来是我正在启动Tomcat
jpda选项,其中catalina.bat转换为

In the end the problem turned out to be that I was starting Tomcat with the "jpda" option, which catalina.bat translates into

-Xdebug -Xrunjdwp:transport=.....

删除jpda命令参数导致JVMTI开始工作。

Removing the "jpda" command argument caused JVMTI to start working.

SO,问题是:我在任何搜索中没有发现
表示JVMTI代理与调试不兼容。可以
有人解释发生了什么,为什么JVMTI + JDWP不是有效的
设置?

SO, the question is: I found nothing during any of my searches to indicate that a JVMTI agent is incompatible with debugging. Can someone explain what is going on and why JVMTI + JDWP is not a valid setup?

推荐答案

迄今为止没有一个答案是正确的,如果您查询所提到的错误,这是第一次出现在Google上,所以我觉得需要一些澄清。

None of the answers so far are correct and this is the first hit that comes up on Google if you query the error mentioned, so I feel some clarification is needed.

JVMTI和JDWP 一起工作,实际上它们通常必须一起使用。您将获得错误:JDWP无法获取必要的JVMTI功能如果 -Xrunjdwp (和/或可能 -agentlib:jdwp )在命令行上被多次指定。要修复它,请确保在命令行中只有 -Xrunjdwp -agentlib:jdwp 中的一个。

JVMTI and JDWP do work together, in fact they generally must be used together. You will get ERROR: JDWP unable to get necessary JVMTI capabilities if -Xrunjdwp (and/or possibly -agentlib:jdwp) is specified more than once on the command line. To fix it, make sure you only have one of -Xrunjdwp or -agentlib:jdwp in your command line.

有关更多详细信息,请阅读...

For more details, read on...

JVMTI(Java虚拟机工具界面)是后继到JVMDI(Java虚拟机调试接口)和JVMPI(Java虚拟机分析界面)。它集成了JVMDI和JVMPI的功能,两者都在Java 5中被弃用,并在Java 6中被删除。它是为了调试和分析目的而公开JVM内部的API。

JVMTI (Java Virtual Machine Tool Interface) is the successor to JVMDI (Java Virtual Machine Debug Interface) and JVMPI (Java Virtual Machine Profiling Interface). It incorporates the functionality of both JVMDI and JVMPI, both of which were deprecated in Java 5 and removed in Java 6. It is the API that exposes the internals of the JVM for the purposes of debugging and profiling.

JDWP(Java Debug Wire Protocol)是一种描述传输命令和响应的简单机制的协议。据我所知,这是一个位于JVM之外的调试器与它进行通信并与JVMTI进行接口的唯一方法。

JDWP (Java Debug Wire Protocol) is a protocol that describes a simple mechanism for transmitting commands and responses. As far as I know, it is the only way for a debugger sitting outside the JVM to communicate with it and to interface with the JVMTI.

JDI(Java Debugger Interface)是一个客户端(调试器端)API,它暴露了JVMTI的一些功能,同时透明地使用JDWP。

JDI (Java Debugger Interface) is a client-side (debugger-side) API which exposes some of the features of JVMTI while making use of JDWP more or less transparently.

bug 涉及到误导性的错误消息,以及JVM将在每次在命令行中指定时都会尝试加载JDWP一次的事实。 JDWP和JVMTI无法一起使用的任何地方都不会声明。

The bug mentioned in Bob Dobbs's answer concerns the misleading error message, and the fact that the JVM will try to load JDWP once for every time it is specified on the command line. It doesn't state anywhere that JDWP and JVMTI cannot be used together.

更多信息: http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzaha/jpdebuga.htm

这篇关于Java JVMTI不能与-Xdebug -Xrunjdwp一起工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆