Java JVMTI 不能与 -Xdebug -Xrunjdwp 一起工作

发布于 2024-08-07 14:25:27 字数 875 浏览 8 评论 0原文

我花了最后 4 个小时尝试设置 Eclipse TPTP 内存 对必须远程运行的 Tomcat 实例进行分析(即不在 蚀)。根据 TPTP 和代理的说法,这应该是可能的 控制器文档。

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

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

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

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

尝试启动 Tomcat 时,我始终收到以下错误 消息:

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

我做了很多谷歌搜索,但没有找到相关的内容;我试过 重新安装 TPTP 和代理控制器的各个版本。

最后发现问题是我启动了Tomcat 使用“jpda”选项,catalina.bat 将其翻译为

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

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

所以,问题是:我在任何搜索过程中都没有发现任何内容 指示 JVMTI 代理与调试不兼容。能 有人解释发生了什么以及为什么 JVMTI + JDWP 不是有效的 设置?

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.

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

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

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

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

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

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=.....

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

鹤仙姿 2024-08-14 14:25:27

到目前为止,没有一个答案是正确的,如果您查询提到的错误,这是谷歌上出现的第一个结果,所以我觉得需要一些澄清。

JVMTI 和 JDWP 确实一起工作,事实上它们通常必须一起使用。如果 -Xrunjdwp(和/或可能 -agentlib:jdwp)指定的值超过一旦进入命令行。要修复此问题,请确保命令行中只有 -Xrunjdwp-agentlib:jdwp 之一。

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

JVMTI(Java 虚拟机工具接口)是 JVMDI(Java 虚拟机调试接口)和 JVMPI(Java 虚拟机分析接口)的继承者。它结合了 JVMDI 和 JVMPI 的功能,这两个功能在 Java 5 中已被弃用,并在 Java 6 中被删除。它是为了调试和分析目的而公开 JVM 内部结构的 API。

JDWP(Java 调试线协议)是一种描述传输命令和响应的简单机制的协议。据我所知,这是 JVM 外部的调试器与其通信并与 JVMTI 交互的唯一方法。

JDI(Java 调试器接口)是一个客户端(调试器端)API,它公开 JVMTI 的一些功能,同时或多或少透明地使用 JDWP。

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

更多信息请参见:https://www.ibm.com/support/知识中心/ssw_ibm_i_74/rzaha/jpdebuga.htm

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 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 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) 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) is a client-side (debugger-side) API which exposes some of the features of JVMTI while making use of JDWP more or less transparently.

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.

More info here: https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzaha/jpdebuga.htm

转身以后 2024-08-14 14:25:27

我遇到了和你一样的问题,但我提出了一个 JVM 错误报告 (https ://bugs.java.com/bugdatabase/view_bug?bug_id=6354345),这对这个问题有所帮助。这基本上可以归结为 Java 代理库不应该被两次加载到同一个虚拟机中。很糟糕,但这似乎是代理系统的基本限制,你不能同时做这两件事。

I ran into the same problem as you, but I came up with a JVM bug report (https://bugs.java.com/bugdatabase/view_bug?bug_id=6354345) that cast some light on the issue. It basically comes down to the Java agent library not ever being intended to be loaded twice into the same VM. Sucks, but seems like it's basic limitation of the agent system that you can't do both at the same time.

没有心的人 2024-08-14 14:25:27

对我来说,这是与 Code Bling 帖子相同的问题,它们是重复的 -Xrunjdwp 没有意识到还有第二个 -Xrunjdwp 因为它隐藏在变量 中>%JAVA_OPTIONS%,检查您的应用程序服务器启动脚本。

For me it was the same issue as Code Bling post, they were duplicate -Xrunjdwp didn't realize there were a second -Xrunjdwp as it was hidden in the variable %JAVA_OPTIONS%, check your Application Server start script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文