First8 staat voor vakmanschap. Al onze collega’s zijn een groot aanhanger van Open Source en in het bijzonder het Java-platform. Wij zijn gespecialiseerd in het pragmatisch ontwikkelen van bedrijfskritische Java toepassingen waarbij integratie van systemen, hoge eisen aan beveiliging en veel transacties een belangrijke rol spelen. Op deze pagina vind je onze blogs.

Using Mission Control for remote profiling

Since version 7u40, Oracle supplies Mission Control with the JDK. It uses the same technology stack as VisualVM so you can use it to profile your applications remotely using the same parameters as described in some previous blog posts (here or here).

If you want to use Mission Control, simply run jmc from your ${JAVA_HOME}/bin directory. If you’re lucky, it’s already on your path.

However, to make use of the flight recorder option, you’ll need to add some more parameters to the mix. If you have protectected your JMX connection with a password, as described here, you probably get a message like:

Could not register the Mission Control MBean in the MBeanServer.

This is probably caused by not having enough permissions assigned to your role. In the previous blog post, I used the controlRole default from the JDK. Unfortunately, this one does not have enough permissions by default. So we’ll need to redefine it. Create a jmxremote.access next to your existing jmxremote.password, and add the following content:

monitorRole readonly
controlRole readwrite
create javax.management.monitor.*,javax.management.timer.*,com.sun.management.*,com.oracle.jrockit.*
unregister

Note that we assign write access to com.sun.management and to com.oracle.jrockit for the controlRole. The JRockit stuff is interesting: Mission Control used to be a JRockit feature. Oracle is now merging HotSpot and JRockit so there will be some mixture of parameters here. We’ll need to tell the JVM to use this access file using -Dcom.sun.management.jmxremote.access.file=jmxremote.access.

Next, we’ll need to enable Mission Control on the JVM which is to be monitored. This is done by adding:

-XX:+UnlockCommercialFeatures
-XX:+FlightRecorder

Yes, it is a commercial feature. License stuff etc. For occasional development I guess it would be ok.

So, to enable remote profiling using Mission Control and protect it minimally with a password, we’ll need to run something like:

Phew.

Read more: