Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when retrieving virtual machine images #1181

Closed
selevt opened this issue Oct 10, 2016 · 9 comments
Closed

NPE when retrieving virtual machine images #1181

selevt opened this issue Oct 10, 2016 · 9 comments
Assignees

Comments

@selevt
Copy link

selevt commented Oct 10, 2016

Retrieving the images from the germany region with beta3 fails with a NPE.

Example:

// Authentication to AzureEnvironment.AZURE_GERMANY
...
for (VirtualMachineImage img : azure.virtualMachineImages().listByRegion(Region.GERMANY_CENTRAL))
{
}

Stacktrace:

java.lang.NullPointerException
    at com.microsoft.azure.management.compute.implementation.ChildListFlattener$1.nextPage(ChildListFlattener.java:76)
    at com.microsoft.azure.PagedList.cachePage(PagedList.java:59)
    at com.microsoft.azure.PagedList.loadNextPage(PagedList.java:98)
    at com.microsoft.azure.PagedList$ListItr.next(PagedList.java:161)
@martinsawicki
Copy link

martinsawicki commented Oct 10, 2016

US_WEST works fine from what I can tell.
GERMANY_CENTRAL fails already on listing publishers.
Internally, I see this failure:

INFO: <-- 400 Bad Request https://management.azure.com/subscriptions/9657ab5d-4a4a-4fd2-ae7a-4cd9fbd030ef/providers/Microsoft.Compute/locations/germanycentral/publishers?api-version=2016-03-30

A more explanatory error we get after that is:

INFO: {"error":{"code":"NoRegisteredProviderFound","message":"No registered resource provider found for location 'germanycentral' and API version '2016-03-30' for type 'locations/publishers'. The supported api-versions are '2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-04-30-preview'. The supported locations are 'eastus, eastus2, westus, centralus, northcentralus, southcentralus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest, australiaeast, australiasoutheast, brazilsouth, southindia, centralindia, westindia, canadacentral, canadaeast, westus2, westcentralus, uksouth, ukwest'."}}

Germany is not listed in the error. Not sure if GERMANY_* is not yet supported by this provider, or if it blocks access unless you have special permissions (accessing only from within Germany), in which case not sure how we would be able to test this..
@jianghaolu, @anuchandy - toughts?

@martinsawicki
Copy link

also, @selevt - are you running this code from inside Germany?

@selevt
Copy link
Author

selevt commented Oct 10, 2016

@martinsawicki yes, running this from Germany

@martinsawicki
Copy link

@jianghaolu, could it be related to the API version? Looking at the error, I see the SDK is using 2016-03-30, while Germany was added much more recently...

@jianghaolu
Copy link
Contributor

jianghaolu commented Oct 10, 2016

@selevt Do you happen to have a dependency on an older version of azure-client-runtime?

@anuchandy
Copy link
Member

@selevt please confirm the azure-client-runtime version as Jianghao mentioned.

also could you try listing the publishers as mentioned below. We need your help to debug this since our test subscription is not enabled for German regions.

Azure azure = Azure
     .configure()
     .withLogLevel(HttpLoggingInterceptor.Level.BODY)
     .authenticate(credFile)
     .withDefaultSubscription();

for (VirtualMachinePublisher p : azure. azure.virtualMachineImages().publishers().listByRegion(Region.GERMANY_CENTRAL)) {
  System.out.Println(p.Region());
}

The reason for listing publisher is to narrow down the issue you are seeing, listing images in a region involves listing 4 levels of parent resources, but publisher listing is a single level call.

We have logging enabled for the above azure client via HttpLoggingInterceptor.Level.BODY.

In the log,

  1. Do you see any error?
  2. If no error do you see the json response from the server that contains publisher list , if yes can you check and tell us the content of region property of a publisher?

@jianghaolu
Copy link
Contributor

@selevt I can reproduce it with everything latest. Seems like a bug in the ChildListFlattener. I'm investigating.

@jianghaolu
Copy link
Contributor

Fixed in a pull request. Will let you know when it's merged and released as a snapshot package.

@jianghaolu
Copy link
Contributor

This has been fixed and released since beta4.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants