i tried to change the memory size of the running VM but i get the errors below
my virtualbox version: 5.0.10
Operating system: Centos 6.7
Language: java
connect type: web service
my code is
Code: Select all
static void testStart(VirtualBoxManager mgr, IVirtualBox vbox)
{
IMachine m = vbox.getMachines().get(0);
String name = m.getName();
System.out.println("\nAttempting to start VM '" + name + "'");
ISession session = mgr.getSessionObject();
IProgress p = m.launchVMProcess(session, "gui", "");
progressBar(mgr, p, 10000);
session.unlockMachine();
System.out.println("VM state: "+m.getState().toString());
System.out.println("Memory Amount: " + m.getMemorySize());
m.lockMachine(session, LockType.Shared);
session.getMachine().setMemorySize(1024l);
session.getMachine().saveSettings();
session.unlockMachine();
}
Code: Select all
m.lockMachine (session, LockType.Shared);
Code: Select all
m.lockMachine(session, LockType.write);
VirtualBox version: 5.0.10
Code: Select all
Attempting to start VM 'VM1'
VM state: Running
Memory Amount: 1024
VBox error: VirtualBox error: rc=0x80bb0002 The machine is not mutable (state is Running) (0x80bb0002)
Error cause message: org.virtualbox_5_0.jaxws.RuntimeFaultMsg: VirtualBox error: rc=0x80bb0002 The machine is not mutable (state is Running) (0x80bb0002)
Overall result code: 80bb0002
Detail information #1
Error mesage: The machine is not mutable (state is Running)
Result code: 80bb0002
Component: SessionMachine
Interface ID: f30138d4-e5ea-4b3a-8858-a059de4c93fd
Java stack trace:
org.virtualbox_5_0.VBoxException: VirtualBox error: rc=0x80bb0002 The machine is not mutable (state is Running) (0x80bb0002)
at org.virtualbox_5_0.IMachine.setMemorySize(IMachine.java:790)
at Vmtest.TestVBox.testStart(TestVBox.java:180)
at Vmtest.TestVBox.main(TestVBox.java:315)
Caused by: org.virtualbox_5_0.jaxws.RuntimeFaultMsg: VirtualBox error: rc=0x80bb0002 The machine is not mutable (state is Running) (0x80bb0002)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
at com.sun.proxy.$Proxy24.iMachineSetMemorySize(Unknown Source)
at org.virtualbox_5_0.IMachine.setMemorySize(IMachine.java:782)
... 2 more