我想以编程方式从vSphere / vCenter部署VM模板,所以首先我从VMware下载SDK zip并将Web服务sdk中的VMClone.java复制到Eclipse项目中并使用以下代码运行它:
String[] myargs = new String[12];
myargs[0] = "--url";
myargs[1] = "https://192.168.0.91:9443";
myargs[2] = "--username";
myargs[3] = "[myuser]";
myargs[4] = "--password";
myargs[5] = "[mypassword].";
myargs[6] = "--datacentername";
myargs[7] = "LaptopIkor";
myargs[8] = "--vmpath";
myargs[9] = "[datastore1]/liferayTomcat/liferayTomcat.vmx";
myargs[10] = "--clonename";
myargs[11] = "DriverCreation1";
com.vmware.vm.VMClone.main(myargs);
(这只是一个示例设置,因此上述代码没有隐私问题) (是的,这段代码不是很好,只是为了测试)
但是这会失败并显示以下消息/ stacktrace:
com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 200: OK
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source)
at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(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 $Proxy35.retrieveServiceContent(Unknown Source)
at com.vmware.vm.VMCreate.connect(VMCreate.java:287)
at com.vmware.vm.VMCreate.main(VMCreate.java:1047)
at (my own class with above code)
VMCreate以及使用samples.jar而不是复制源文件时也会发生这种情况。知道如何解决这个问题吗?
该网址指向安装了vCenter Server的win2008服务器,包括vSphere Web Client。
感谢您的帮助。
答案 0 :(得分:0)
myargs[1] = "https://192.168.0.91:9443";
尝试
myargs[1] = "https://192.168.0.91/sdk";