NetBeans 6.0 JMX new features

NetBeans 6.0 is out. You should go experience the new Editor, really amazing... What does it add compared to the previous one? Well... not a lot of things... It simply anticipates your coding, checks your coding and drives you to write better more than that... Kudo to the NetBeans team!

JMX module is part of the game and still downloadable from the stable update center. I am pasting a screenshot of the new update center UI that you now find in NetBeans 6.0.

In this blog entry I am focusing on JDK 6.0 JConsole related new features. You can access to the list of features, latest tutorials, documentation and known issues from this web site :

JConsole to Monitor J2SE Project

If you are used to the JMX module, you will notice that the way to connect JConsole to your J2SE Project has not changed.

Just set your J2SE Project as the “main project”and click on this toolbar button:

Your project will be compiled, run and JConsole will attach to it. The way to setup JConsole and the Monitoring & Management features of your project has changed. The next chapter shows you how to achieve such configuration.

Better integration in J2SE project

Right click on your Project to access the project properties. You will notice a “Monitoring and Management” section. This is your configuration entry point.

From there you can:

  • Enable / Disable JConsole auto attachment.

  • Change JConsole polling period.

  • Use (or not) the project classpath to make JConsole findout your MBean custom handled types. Unselecting this option will show you that you introduced some custom types that imply deployment of these classes on the JMX client application. Having custom types handled by your MBean interfaces is not something that we encourage and this is something that you can simply avoid by using MXBean

  • Lookup the Project Classpath to load JConsole custom plugins. A new JConsole API has been defined in order to allow you to develop custom JConsole tabs and have them added to the list of tabs. The next chapter cover this feature. This article describes JDK 6.0 JConsole plugins new feature.

  • Explicitly add paths to your JConsole plugins jar files or classes.

  • Enable or disable Remote RMI access. By default, remoting is not enabled.

      • You can provide the RMI port the server will listen to. Doing so, you will start a non secure remote access.

      • Or you can provide a path to a file in which you can configure security.

New Support to load JConsole custom tabs

To do so, simply add JConsole plugins that you downloaded or developed, to the Monitoring and Management Properties Plugins Path list.

In this example, I am adding the JTop plugin that is bundled with JDK 6.0 (<java home>/demo/management/JTop/JTop.jar). This plugin demonstrates the use of the API to obtain the CPU consumption for each thread.

Add the plugin to the Project properties and run your application

In the “Monitoring and Management” Properties :

  1. click on Add Jar/Folder button then provide a path to JTop jar file. The jar file is added to the list.

  2. Close the project properties.

  3. Run your project with by clicking on the JConsole toolbar button.

JConsole is started, JTop tab being loaded and displayed.

Some interesting JConsole plugins

JConsole to Monitor any Java project

If you want to connect JConsole to another kind of Java project (e.g.: Web Application), you can start JConsole and connect it to the application server running your application. To do so click on the following toolbar button to launch JConsole management console:

You can tune the JConsole default Target (default URL to connect to), polling period, plugins path, classpath, arguments or JVM arguments from the NetBeans Options. To do so:

  1. Select Tools | Options from the main menu

  2. Select Miscellaneous tab

  3. Select JConsole tab

The following window is displayed:

Hope to have helped you discover a useful new feature of the JMX tooling.


Jean-François Denise

(jean-francois dot denise at sun dot com)


Hy Jean-François,

The plugin seems interesting to me as I'm starting to use JConsole more and more. The project integration is nice though I've started using only Maven2 projects (via MevenIDE) so all the integration is invisible for me.

What I don't like is that you use the standard JConsole implementation( Something like this would need a better implementation with the IDE.

For example place yourself in the Services tab, add a JConsole node with subnodes representing the pids, then display the actual JConsole tabs as tabs inside a TopComponents, etc.

Some integration work seems to be going on in VisualVM ( so maybe we just need a separate cluster for visualvm, available from the netbeans update center.

Posted by Emilian Bold on December 03, 2007 at 11:18 AM GMT+02:00 #

Post a Comment:
Comments are closed for this entry.



« July 2016