throw new InvalidPluginConfigurationException("A command line is required for the "
+ connectionTypeDescriptorClassName + " connection type.");
}
Map<Integer, LocalVirtualMachine> vms = LocalVMFinder.getManageableVirtualMachines();
LocalVirtualMachine targetVm = null;
if (vms != null) {
for (LocalVirtualMachine vm : vms.values()) {
if (vm.getCommandLine().equals(commandLine)) {
targetVm = vm;
break;
}
}
}
if (targetVm == null) {
// This could just be because the JVM is not currently running.
throw new Exception("JVM with command line [" + commandLine + "] not found.");
}
String vmId = String.valueOf(targetVm.getVmid());
settings.setServerUrl(vmId);
} else if (connectionTypeDescriptor instanceof J2SE5ConnectionTypeDescriptor) {
// Connect via JMX Remoting, using the JVM Attach API to start up a JMX Remoting Agent if necessary.
String jmxConnectorAddress = getJmxConnectorAddress(pluginConfig, process);
settings.setServerUrl(jmxConnectorAddress);