VirtualMachine capture throws NullPointerException - VirtualMachineImpl.java:209
NPE at VirtualMachineImpl.java:209
Trying to capture a windows VM.
java.lang.NullPointerException .. at com.microsoft.azure.management.compute.implementation.VirtualMachineImpl.capture(VirtualMachineImpl.java:209) at com.workspot.connector.azure.AzureManager.createImage(AzureManager.java:530)
It's a known issue, we are working on updating run-time to de-serialize response of LRO Post & Delete. Capture is a LRO Post and not de-serializing the result cause NPE.
I'm trying to use this library to automate some processes and I'm coming across this problem. Is this expected to be addressed soon?
@jianghaolu the result returned from the inner call is null here, so this problem is somewhere deep in the runtime and/or generated code. Also a regression, since we have a published sample that worked in the past that uses vm.capture().
The vhd gets created eventually. But no response is returned. I think the actual REST endpoint might be returning an empty response. I tried calling the REST API directly and I'm receiving the same response code but no payload data and then eventually the captured image gets created.
thank you for additional hint, we'll see if we're there is some REST API breakage we're looking at here...
Actually, I think this is normal. I looked into a it a little bit more and it looks like for long running operations, the API returns the header Azure-AsyncOperation with the URL to request the operation status. This is actually happening, the azure client does follow up on the status of the operation once and the operation returns InProgress. After this, the client doesn't follow up on the operation anymore. I suspect it has to do with the obsevable objects. The first check on the operation occurs as expected because the initial request contains the Azure-AsyncOperation header. However, I think the subsequent requests are based on the responses of the operation status which do not contain the Azure-AsyncOperation header. I think this is why the client is actually dropping any further checks and just returning null. Are you experiencing this behavior with other long running operations?
fixed in the latest update: 1.0.0-beta4.1 available on Maven.