Page 1 of 1

Error connecting VirtualBoxManager with Web Service (Java)

Posted: 30. Sep 2016, 13:28
by tirimao
Virtualbox version = 5.0.26
Virtualbox API version = 5_0
Connection type =Webserver
Language used = Java
OS = OS X 10.11.6

Hi there! I'm encountering a problem trying to connect my Java program to the local VBox web server. (Note: I obviously already started the vboxwebsrv)
This is the error occured:

Code: Select all

org.virtualbox_5_0.VBoxException: Connect doesn't make sense for local bindings
	at org.virtualbox_5_0.VirtualBoxManager.connect(VirtualBoxManager.java:51)
	at utils.TestVBox.main(TestVBox.java:243)
Cannot connect, start webserver first!
I simply tried to establish a connection to the local web server as stated in SDKref pdf and in the sample code (TestVBox.java shipped with SDK):

Code: Select all

private VirtualBoxManager vboxm= null;
	final String location = localLoc
	String username = null;
	String password = null;
vboxm = VirtualBoxManager.createInstance(null);
      
           try {
               vboxm.connect(location, username, password);
           } catch (VBoxException e) {
               e.printStackTrace();
               System.out.println("Cannot connect, start webserver first!");
           }
        
I tried to use even the TestVBox program (passing as parameter -w ) and same error occurs.
It seems like I'm doing something wrong, anyone could help me?
Is there anyone who use the local VBox Java web server, and how?

Re: Error connecting VirtualBoxManager with Web Service (Java)

Posted: 30. Sep 2016, 14:16
by noteirak
tirimao wrote:org.virtualbox_5_0.VBoxException: Connect doesn't make sense for local bindings
This error means you are using the XPCOM bindings and trying to connect to the WebServices. You need to use the WebServices bindings instead.
Use the following file (path relative to the ZIP root):

Code: Select all

/sdk/bindings/webservice/java/jax-ws/vboxjws.jar

Re: Error connecting VirtualBoxManager with Web Service (Java)

Posted: 3. Oct 2016, 02:14
by tirimao
Sorry noteirak, I didn't mention the class paths I used.
vboxjws.jar (file you mentioned) was already in my classpath, so the error still persist and I don't know what I'm doing wrong.

Re: Error connecting VirtualBoxManager with Web Service (Java)

Posted: 3. Oct 2016, 02:26
by noteirak
Then you most likely have another binding in your classpath as well. Make sure only one binding is included - the WebServices one.

Re: Error connecting VirtualBoxManager with Web Service (Java)

Posted: 3. Oct 2016, 17:57
by tirimao
Well Thank you for your Help!
I added time ago the xpcom binding in general Java class path and then forgot it so even adding the path to the web service jar, my program was forced to use the wrong binding. Now all seems to be OK!
Thanks you a lot!