views:

101

answers:

1

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

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

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?

+2  A: 

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.

JB
Thanks! This has solved the installation error. However, my agent and client jars are still not being bundled into the nbm file. At runtime I use http://github.com/mchr3k/org.intrace/blob/master/InTrace-VisualVM-Plugin/src/org/intrace/visualvm/Locator.java to find the path to these jars and this currently returns null when using the built nbm file. These jars are located correctly when I run the plugin directly from Netbeans: Agent Path: C:\Work\GitHub\InTrace\InTrace-VisualVM-Plugin\build\cluster\modules\ext\intrace-agent.jar.Do you know how I can solve this?
mchr
Actually, in order to access your 3rd party libraries you would need to create a library wrapper module, wrap in your jars (a simple wizard will help here) and then bundle the library wrapper and your actual module into one module suite (another project type). Check out http://wiki.netbeans.org/DevFaqWrapperModules for more information about library wrappers.Once you set-up your modules like this you can use InstalledFileLocator (http://bits.netbeans.org/dev/javadoc/index.html) to get the actual location of your jars.
JB
Success! I don't actually need to use any classes from these jars within VisualVM. I only need to have filesystem access to the jars. It was therefore sufficient for me to manually place the jars into release/modules/ext/ and it just worked (TM) - http://github.com/mchr3k/org.intrace/tree/master/InTrace-VisualVM/release/modules/ext/. Thanks for all your help.
mchr