2

I configured IDEA to use java mission control as following -

enter image description here

And during debugging main method I encountered following exception on Java Mission control -

java.lang.RuntimeException: Could not connect to com.seleniumtests.tests.RetryTest (11952). Make sure the JVM is running and that you are using the correct protocol in the Service URL (null).
at com.jrockit.mc.flightrecorder.controlpanel.ui.FlightRecorderProvider.refresh(FlightRecorderProvider.java:109)
at com.jrockit.mc.browser.views.JVMBrowserView$1.run(JVMBrowserView.java:102)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.jrockit.mc.rjmx.ConnectionException caused by com.jrockit.mc.browser.attach.LazyServiceURLResolveException: The in memory agent can not be started on this JVM, since attach is not supported! If you're trying to connect to a 32-bit JVM with a 64-bit Mission Control or vice versa, start the management agent manually by using the JVM flag -Dcom.sun.management.jmxremote for your JVM prior to trying to connect to it.
at com.jrockit.mc.rjmx.internal.RJMXConnection.connect(RJMXConnection.java:534)
at com.jrockit.mc.rjmx.ServerHandle.doConnect(ServerHandle.java:89)
at com.jrockit.mc.rjmx.ServerHandle.connect(ServerHandle.java:70)
at com.jrockit.mc.flightrecorder.controlpanel.ui.FlightRecorderProvider.refresh(FlightRecorderProvider.java:96)
... 8 more
Caused by: com.jrockit.mc.browser.attach.LazyServiceURLResolveException: The in memory agent can not be started on this JVM, since attach is not supported! If you're trying to connect to a 32-bit JVM with a 64-bit Mission Control or vice versa, start the management agent manually by using the JVM flag -Dcom.sun.management.jmxremote for your JVM prior to trying to connect to it.
at com.jrockit.mc.browser.attach.LocalConnectionDescriptor.createJMXServiceURL(LocalConnectionDescriptor.java:166)
at com.jrockit.mc.rjmx.internal.RJMXConnection.connect(RJMXConnection.java:532)
... 11 more 

I am running 64bit java (jdk1.7.0_72) and same is being used as sdk in IntelliJ

The test method is -

public static void main(final String[] args) {
    System.out.println(System.getProperty("sun.arch.data.model"));
}

Did I miss any configuration?

Tarun
  • 3,456
  • 10
  • 48
  • 82
  • If you are using HotSpot JVM, then run using this vm option "-Dcom.sun.management.jmxremote" – Gaurav Feb 22 '18 at 16:33
  • I am using with eclipse and it works perfectly. IntelliJ idea is bit delaying to bring this on : https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000796090-IntelliJ-Java-Flight-Recorder-JFR-integration – dkb Feb 20 '19 at 06:29
  • Set up for eclipse: https://download.oracle.com/technology/products/missioncontrol/updatesites/base/6.0.0/eclipse/ – dkb Feb 20 '19 at 06:33

2 Answers2

1

Necroposting here, but maybe will help someone later.

I had a very similar issue with the same stack and reason that was caused by a corporate AV solution, that decided that this was very clearly an exploit. Tweaking the settings on it to allow the connection fixed it.

Ordous
  • 3,844
  • 15
  • 25
0

That method will execute very quickly. What you probably want to do is to start a recording on the command line. You can do that with the following VM options,

-XX:+UnlockCommercialFeatures 
-XX:+FlightRecorder 
-XX:StartFlightRecording=filename=recording.jfr

and then open the file in JMC.

Kire Haglin
  • 6,569
  • 22
  • 27
  • I am running test on debug mode and this was just an example. Eventually I want to step through application code on IDEA and derive conclusion on application. But I am stuck with this error and can not proceed with IDEA. – Tarun Jan 06 '16 at 13:47
  • Are you able to connect from JMC to something not started from IntelliJ? Does the suggestion in the error message "start the management agent manually by using the JVM flag -Dcom.sun.management.jmxremote for your JVM prior to trying to connect to it." help? I've tried to reproduce this with 7u79 on Windows, launching a dummy app from IntelliJ, but that worked fine. – Klara Jan 08 '16 at 10:33