简体   繁体   中英

Java mission control can not connect to Test Class in IDEA

I configured IDEA to use java mission control as following -

在此处输入图片说明

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM