Machine is already locked for a session

Discussions related to using VirtualBox on Windows hosts.
Post Reply
BobKubista
Posts: 5
Joined: 27. Jul 2012, 13:47

Machine is already locked for a session

Post by BobKubista »

Hi,

I'm trying to manipulate a linux VM (hosted on windows) via the VBox webservice. First I shutdown my VM, but when I want to change stuff on it with the webservice (and java), I get: The machine "X" is already locked for a session (or being unlocked). My code goes wrong when locking with the write locktype.

Anyone got any Idea's?

Code: Select all

LOGGER.info("connecting to VM");
		VirtualBoxManager manager = VirtualBoxManager.createInstance(null);
		manager.connect("http://localhost:18083", "", "");
		final IVirtualBox box = manager.getVBox();
		IMachine machine = box.findMachine("Linux");
		IStorageController controller = machine.getStorageControllerByName("Storage");
		
		ISession session = manager.getSessionObject();		
		machine.lockMachine(session, LockType.Write);
		IMachine openedMachine = session.getMachine();
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Machine is already locked for a session

Post by noteirak »

Would this bug be your problem?
If yes, just turn all your VM off, vboxwebsrv, wait 10 sec, turn vboxwebsrv back on and try again.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply