Java任务控制无法连接到IDEA中的Test Class

时间:2016-01-04 11:45:37

标签: java intellij-idea java-mission-control

我将IDEA配置为使用java任务控制,如下所示 -

enter image description here

在调试main方法期间,我在Java Mission控件上遇到了以下异常 -

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 

我正在运行64位java(jdk1.7.0_72),同样在IntelliJ中用作sdk

测试方法是 -

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

我错过了任何配置吗?

2 个答案:

答案 0 :(得分:0)

该方法将很快执行。您可能想要做的是在命令行上开始录制。您可以使用以下VM选项

执行此操作
-XX:+UnlockCommercialFeatures 
-XX:+FlightRecorder 
-XX:StartFlightRecording=filename=recording.jfr

然后在JMC中打开文件。

答案 1 :(得分:0)

在这里进行尸体解剖,但也许以后会帮助某人。

我遇到了一个非常类似的问题,这个问题是由企业AV解决方案引起的相同堆栈和原因,这决定了这显然是一个漏洞。调整其上的设置以允许连接修复它。