如何将Java Agent打包为Visual VM插件

发布于 2024-09-12 08:42:20 字数 1838 浏览 0 评论 0原文

我编写了一个 Java 代理以及一个用于控制代理的 SWT GUI。

https://github.com/mchr3k/org.intrace/wiki

我想要将此库打包到 VisualVM 的插件中,以允许使用 VisualVM 将代理连接到 JVM。

我在这里编写了一个 Netbeans 模块来执行此操作:

http ://github.com/mchr3k/org.intrace/tree/master/InTrace-VisualVM-Plugin/

当我从 Netbeans 运行项目时,这有效。但是,当我使用“创建 NBM”打包项目时,生成的库无法安装在 VisualVM 中。日志的输出如下:

INFO [org.netbeans.modules.autoupdate.services.InstallSupportImpl]: Timeout waiting for loading module org.intrace.visualvm/1.0 
INFO [org.netbeans.modules.autoupdate.ui.wizards.InstallStep]: timeout of loading InTrace Launcher[org.intrace.visualvm/1.0] 
org.netbeans.api.autoupdate.OperationException: timeout of loading InTrace Launcher[org.intrace.visualvm/1.0] 
   at org.netbeans.modules.autoupdate.services.InstallSupportImpl$3.call(InstallSupportImpl.java:437) 
   at org.netbeans.modules.autoupdate.services.InstallSupportImpl$3.call(InstallSupportImpl.java:302) 
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
   at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) 
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) 
[catch] at java.lang.Thread.run(Thread.java:619) 

我还怀疑我的代理和客户端库尚未打包到 nbm 文件中,因为它太小了。

我怀疑问题是我需要在项目 build.xml 中添加一些内容,但我正在努力弄清楚什么。

http://github.com/mchr3k/ org.intrace/blob/master/InTrace-VisualVM-Plugin/build.xml

任何人都可以建议我缺少什么吗?

I have written a Java Agent along with an SWT GUI for controlling the agent.

https://github.com/mchr3k/org.intrace/wiki

I want to package this library into a plugin for VisualVM to allow the agent to be attached to a JVM using VisualVM.

I have written a Netbeans module to do this right here:

http://github.com/mchr3k/org.intrace/tree/master/InTrace-VisualVM-Plugin/

This works when I run the project from Netbeans. However, when I use "Create NBM" to package the project the resulting library fails to install in VisualVM. The output from the log is as follows:

INFO [org.netbeans.modules.autoupdate.services.InstallSupportImpl]: Timeout waiting for loading module org.intrace.visualvm/1.0 
INFO [org.netbeans.modules.autoupdate.ui.wizards.InstallStep]: timeout of loading InTrace Launcher[org.intrace.visualvm/1.0] 
org.netbeans.api.autoupdate.OperationException: timeout of loading InTrace Launcher[org.intrace.visualvm/1.0] 
   at org.netbeans.modules.autoupdate.services.InstallSupportImpl$3.call(InstallSupportImpl.java:437) 
   at org.netbeans.modules.autoupdate.services.InstallSupportImpl$3.call(InstallSupportImpl.java:302) 
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
   at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) 
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) 
[catch] at java.lang.Thread.run(Thread.java:619) 

I'm also suspicious that my agent and client libraries have not been packaged into the nbm file as it is way too small.

I suspect that the problem is that I need to add something to the project build.xml but I am struggling to work out what.

http://github.com/mchr3k/org.intrace/blob/master/InTrace-VisualVM-Plugin/build.xml

Can anyone suggest what I am missing?

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

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

发布评论

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

评论(1

女中豪杰 2024-09-19 08:42:20

让我猜猜 - 您正在使用 NetBeans 6.9 来开发和打包模块,然后尝试将其加载到 VisualVM 1.2.* 或 jvisualvm 中?如果是这种情况,您刚刚遇到了兼容性问题,因为面向 NetBeans 6.9 平台的模块无法轻松安装在例如中。基于 NetBeans 6.8 的应用程序(例如 VisualVM 1.2.*)。这是由于 NB6.9 平台使用 pack200 压缩/解压缩模块 jar 造成的。

为了将模块定位到旧平台(并且仍然使用最新的 IDE 构建它),您需要手动指定插件平台使用的模块线束(转到“Tools/NetBeans Platforms/”,然后选择“Harness”选项卡并选择来自可以在此处下载的二进制文件的工具

。您重建模块并创建 NBM,它应该可以在 VisualVM 1.2.* 以及 jvisualvm 中工作。

Let me guess - you are using NetBeans 6.9 to develop and package the module and then you try to load it in VisualVM 1.2.* or jvisualvm? If that's the case you've just encountered a compatibility issue when modules targeted to NetBeans 6.9 platform are not easily installable in eg. NetBeans 6.8 based application (such as VisualVM 1.2.*). This is caused by NB6.9 platform compressing/uncompressing the module jars using pack200.

In order to target the module to the older platform (and still build it using the lates IDE) you need to manually specify the module harness used by the plugins platform (go to "Tools/NetBeans Platforms/" and then select the "Harness" tab and choose the harness that comes from the binaries you can download here.

When you rebuild the module and create the NBM it should work in VisualVM 1.2.* as well as jvisualvm.

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