Service or property error

Just when I run this code:

Configuration azureConfig = ManagementConfiguration.configure( new URI("https://management.core.windows.net/"), "asdasdasd", "server.keystore", "asdasdasd", KeyStoreType.jks ); ManagementClient client = ManagementService.create(azureConfig); LocationsListResponse response = client.getLocationsOperations().list(); ArrayList locations = response.getLocations(); for( int i=0; i<locations.size(); i++){ System.out.println(((LocationsListResponse.Location)locations.get(i)).getDisplayName()); } 

I get this:

 00:52:04 [SEVERE] java.lang.RuntimeException: Service or property not registered: com.microsoft.windowsazure.management.ManagementClient interface com.microsoft.windowsazure.management.ManagementClient 00:52:04 [SEVERE] at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:197) 00:52:04 [SEVERE] at com.microsoft.windowsazure.Configuration.create(Configuration.java:113) 00:52:04 [SEVERE] at com.microsoft.windowsazure.management.ManagementService.create(ManagementService.java:46) 00:52:04 [SEVERE] at {LINE OF CODE THAT CONTAINS ManagementClient client = ManagementService.create(azureConfig);} 

On the Internet there is only one question about this, about Android and does not have a clear answer ... Has someone solved this problem?

I run it under OpenLogic 6.5 (based on CentOS) in a virtual machine from Azure with Java 1.8.

EDIT: I created a new project and started it from eclipse. I get the correct results, but when I run it from the command line (java -jar test.jar), I get exactly the same error.

+1
source share
1 answer

I also ran into a similar problem. Explicit definition of the context class loader resolved the issue

 // Get current context class loader ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); // Change context classloader to class context loader Thread.currentThread().setContextClassLoader(AzureManagementServiceDelegate.class.getClassLoader)); try { // Call Azure API and reset back the context loader } catch (Exception e) { // handle exceptions } finally { // Reset back class loader Thread.currentThread().setContextClassLoader(contextLoader); } 
+1
source

All Articles