使用JAVA开发Swift应用-----------列出镜像

根据官网:http://jclouds.apache.org/guides/openstack/#pom上的内容使用Java做出列出镜像的代码。

首先采用maven方式安装jclouds,修改pom.xml文件,其中使用和官网一样的代码:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <properties>
    <jclouds.version>2.2.0</jclouds.version>
  </properties>
  <groupId>org.apache.jclouds.examples</groupId>
  <artifactId>openstack-examples</artifactId>
  <version>1.0</version>
  <dependencies>
    <!-- jclouds dependencies -->
    <dependency>
      <groupId>org.apache.jclouds.driver</groupId>
      <artifactId>jclouds-slf4j</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.driver</groupId>
      <artifactId>jclouds-sshj</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <!-- jclouds OpenStack dependencies -->
    <dependency>
      <groupId>org.apache.jclouds.api</groupId>
      <artifactId>openstack-keystone</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.api</groupId>
      <artifactId>openstack-nova</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.api</groupId>
      <artifactId>openstack-swift</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.api</groupId>
      <artifactId>openstack-cinder</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.api</groupId>
      <artifactId>openstack-trove</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.labs</groupId>
      <artifactId>openstack-glance</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.labs</groupId>
      <artifactId>openstack-marconi</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.labs</groupId>
      <artifactId>openstack-neutron</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
    <!-- 3rd party dependencies -->
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.0.13</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.25</version>
    </dependency>
  </dependencies>
</project>

再使用官网中的代码进行实验,代码为:

import com.google.common.collect.ImmutableSet;
import com.google.common.io.Closeables;
import com.google.inject.Module;
import org.jclouds.ContextBuilder;
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
import org.jclouds.openstack.nova.v2_0.NovaApi;
import org.jclouds.openstack.nova.v2_0.domain.Server;
import org.jclouds.openstack.nova.v2_0.features.ServerApi;

import java.io.Closeable;
import java.io.IOException;
import java.util.Set;

public class JCloudsNova implements Closeable {
    private final NovaApi novaApi;
    private final Set<String> regions;

    public static void main(String[] args) throws IOException {
        JCloudsNova jcloudsNova = new JCloudsNova();

        try {
            jcloudsNova.listServers();
            jcloudsNova.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            jcloudsNova.close();
        }
    }

    public JCloudsNova() {
        Iterable<Module> modules = ImmutableSet.<Module>of(new SLF4JLoggingModule());

        // Please refer to 'Keystone v2-v3 authentication' section for complete authentication use case
        String provider = "openstack-nova";
        String identity = "demo:demo"; // tenantName:userName
        String credential = "devstack";

        novaApi = ContextBuilder.newBuilder(provider)
                .endpoint("http://xxx.xxx.xxx.xxx:5000/v2.0/")
                .credentials(identity, credential)
                .modules(modules)
                .buildApi(NovaApi.class);
        regions = novaApi.getConfiguredRegions();
    }

    private void listServers() {
        for (String region : regions) {
            ServerApi serverApi = novaApi.getServerApi(region);

            System.out.println("Servers in " + region);

            for (Server server : serverApi.listInDetail().concat()) {
                System.out.println("  " + server);
            }
        }
    }

    public void close() throws IOException {
        Closeables.close(novaApi, true);
    }
}

此时会出现错误:

23:51:10.330 [main] DEBUG o.j.rest.internal.InvokeHttpMethod - >> invoking V2AuthenticationApi.authenticatePassword
23:51:10.333 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Sending request -1977492215: POST http://192.168.1.120:5000/v3/tokens HTTP/1.1
23:51:10.333 [main] DEBUG jclouds.wire - >> "Sensitive data in payload, use jclouds.wire.log.sensitive override to enable logging this data."
23:51:10.334 [main] DEBUG jclouds.headers - >> POST http://192.168.1.120:5000/v3/tokens HTTP/1.1
23:51:10.334 [main] DEBUG jclouds.headers - >> Accept: application/json
23:51:10.334 [main] DEBUG jclouds.headers - >> Content-Type: application/json
23:51:10.334 [main] DEBUG jclouds.headers - >> Content-Length: 105
23:51:10.462 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Receiving response -1977492215: HTTP/1.1 404 NOT FOUND
23:51:10.462 [main] DEBUG jclouds.headers - << HTTP/1.1 404 NOT FOUND
23:51:10.462 [main] DEBUG jclouds.headers - << Keep-Alive: timeout=15, max=100
23:51:10.463 [main] DEBUG jclouds.headers - << Server: Apache
23:51:10.463 [main] DEBUG jclouds.headers - << Connection: Keep-Alive
23:51:10.463 [main] DEBUG jclouds.headers - << x-openstack-request-id: req-5eb26751-949f-4101-8422-fa65bc550033
23:51:10.463 [main] DEBUG jclouds.headers - << Vary: X-Auth-Token
23:51:10.463 [main] DEBUG jclouds.headers - << Date: Tue, 18 Feb 2020 15:51:10 GMT
23:51:10.463 [main] DEBUG jclouds.headers - << Content-Type: text/html
23:51:10.463 [main] DEBUG jclouds.headers - << Content-Length: 233
23:51:10.469 [main] DEBUG jclouds.wire - << "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">[\n]"
23:51:10.469 [main] DEBUG jclouds.wire - << "<title>404 Not Found</title>[\n]"
23:51:10.469 [main] DEBUG jclouds.wire - << "<h1>Not Found</h1>[\n]"
23:51:10.469 [main] DEBUG jclouds.wire - << "<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>[\n]"
Exception in thread "main" org.jclouds.rest.ResourceNotFoundException: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>

	at org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:103)
	at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
	at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:138)
	at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:107)
	at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
	at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
	at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
	at com.sun.proxy.$Proxy58.authenticatePassword(Unknown Source)
	at org.jclouds.openstack.keystone.auth.functions.AuthenticatePasswordCredentials.authenticate(AuthenticatePasswordCredentials.java:48)
	at org.jclouds.openstack.keystone.auth.functions.BaseAuthenticator.apply(BaseAuthenticator.java:99)
	at org.jclouds.openstack.keystone.auth.functions.BaseAuthenticator.apply(BaseAuthenticator.java:40)
	at com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:151)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
	at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
	at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830)
	at org.jclouds.openstack.keystone.auth.config.AuthenticationModule$2.get(AuthenticationModule.java:138)
	at org.jclouds.openstack.keystone.auth.config.AuthenticationModule$2.get(AuthenticationModule.java:135)
	at org.jclouds.openstack.keystone.v2_0.catalog.V2ServiceCatalog.get(V2ServiceCatalog.java:57)
	at org.jclouds.openstack.keystone.v2_0.catalog.V2ServiceCatalog.get(V2ServiceCatalog.java:42)
	at org.jclouds.openstack.keystone.catalog.suppliers.LocationIdToURIFromServiceEndpointsForTypeAndVersion.get(LocationIdToURIFromServiceEndpointsForTypeAndVersion.java:76)
	at org.jclouds.openstack.keystone.catalog.suppliers.LocationIdToURIFromServiceEndpointsForTypeAndVersion.get(LocationIdToURIFromServiceEndpointsForTypeAndVersion.java:46)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:75)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
	at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:150)
	at org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:45)
	at org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:33)
	at com.google.common.base.Suppliers$SupplierComposition.get(Suppliers.java:67)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:75)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
	at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:150)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.getInstanceOfTypeWithQualifier(DelegatesToInvocationFunction.java:277)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.lookupValueFromGuice(DelegatesToInvocationFunction.java:234)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:152)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
	at com.sun.proxy.$Proxy60.getConfiguredRegions(Unknown Source)
	at jclouds_swift.jclouds.swift.test.<init>(test.java:51)
	at jclouds_swift.jclouds.swift.test.main(test.java:23)
Caused by: org.jclouds.http.HttpResponseException: command: POST http://192.168.1.120:5000/v3/tokens HTTP/1.1 failed with response: HTTP/1.1 404 NOT FOUND; content: [<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>
]
	at org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:84)
	... 57 more

仔细研读官网上面的内容后,我发现了第三版和第二版之间的区别,并将代码内容改成了:

package jclouds_swift.jclouds.swift;

import com.google.common.collect.ImmutableSet;
import com.google.common.io.Closeables;
import com.google.inject.Module;
import org.jclouds.ContextBuilder;
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
import org.jclouds.openstack.keystone.config.KeystoneProperties;
import org.jclouds.openstack.nova.v2_0.NovaApi;
import org.jclouds.openstack.nova.v2_0.domain.Server;
import org.jclouds.openstack.nova.v2_0.features.ServerApi;

import java.io.Closeable;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;

public class test implements Closeable {
    private final NovaApi novaApi;
    private final Set<String> regions;

    public static void main(String[] args) throws IOException {
        test jcloudsNova = new test();

        try {
            jcloudsNova.listServers();
            jcloudsNova.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            jcloudsNova.close();
        }
    }

    public test() {
        Iterable<Module> modules = ImmutableSet.<Module>of(new SLF4JLoggingModule());
        final Properties overrides = new Properties();
        overrides.put(KeystoneProperties.KEYSTONE_VERSION, "3");
        overrides.put(KeystoneProperties.SCOPE, "project:demo");
        // Please refer to 'Keystone v2-v3 authentication' section for complete authentication use case
        String provider = "openstack-nova";
        String identity = "xxx:xxx"; 
        String credential = "xxxxxxxxxxxxxxx";

        novaApi = ContextBuilder.newBuilder(provider)
                .endpoint("http://xxx.xxx.xxx.xxx:5000/v3")
                .credentials(identity, credential)
                .overrides(overrides)
                .modules(modules)
                .buildApi(NovaApi.class);
        regions = novaApi.getConfiguredRegions();
    }

    private void listServers() {
        for (String region : regions) {
            ServerApi serverApi = novaApi.getServerApi(region);

            System.out.println("Servers in " + region);

            for (Server server : serverApi.listInDetail().concat()) {
                System.out.println("  " + server);
            }
        }
    }

    public void close() throws IOException {
        Closeables.close(novaApi, true);
    }

此时发现可以看见令牌了,但仍有错误如下:

23:55:38.523 [main] DEBUG o.j.rest.internal.InvokeHttpMethod - >> invoking V3AuthenticationApi.authenticatePassword
23:55:38.526 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Sending request 19208166: POST http://xxx.xxx.xxx.xxx:5000/v3/auth/tokens HTTP/1.1
23:55:38.527 [main] DEBUG jclouds.wire - >> "Sensitive data in payload, use jclouds.wire.log.sensitive override to enable logging this data."
23:55:38.527 [main] DEBUG jclouds.headers - >> POST http://xxx.xxx.xxx.xxx:5000/v3/auth/tokens HTTP/1.1
23:55:38.527 [main] DEBUG jclouds.headers - >> Accept: application/json
23:55:38.527 [main] DEBUG jclouds.headers - >> Content-Type: application/json
23:55:38.527 [main] DEBUG jclouds.headers - >> Content-Length: 159
23:55:38.982 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Receiving response 19208166: HTTP/1.1 201 CREATED
23:55:38.982 [main] DEBUG jclouds.headers - << HTTP/1.1 201 CREATED
23:55:38.983 [main] DEBUG jclouds.headers - << Keep-Alive: timeout=15, max=100
23:55:38.983 [main] DEBUG jclouds.headers - << Server: Apache
23:55:38.983 [main] DEBUG jclouds.headers - << Connection: Keep-Alive
23:55:38.983 [main] DEBUG jclouds.headers - << x-openstack-request-id: req-3612f3f7-ebf8-45d6-8784-8c873ff25bb3
23:55:38.983 [main] DEBUG jclouds.headers - << Vary: X-Auth-Token
23:55:38.983 [main] DEBUG jclouds.headers - << X-Subject-Token: gAAAAABeTAj6bRVdfJMgsPbgaidbDK65R5B85bEoCZkyLqvuNmVLGw2sgbPe9btgsN_GRWkY5_hGpdZ38TvRZ03W93xGX4t9nbsWnHf_ZLoQdwt63dMrXSM7HhgyfeMnZKbU9H5_vcJLowUqGyu4p1DtKLNHX3yNNw
23:55:38.983 [main] DEBUG jclouds.headers - << Date: Tue, 18 Feb 2020 15:55:38 GMT
23:55:38.983 [main] DEBUG jclouds.headers - << Content-Type: application/json
23:55:38.983 [main] DEBUG jclouds.headers - << Content-Length: 311
23:55:38.989 [main] DEBUG jclouds.wire - << "{"token": {"issued_at": "2020-02-18T15:55:38.000000Z", "audit_ids": ["IqJO4tJAQV6J472Qm01T9Q"], "methods": ["password"], "expires_at": "2020-02-18T16:55:38.000000Z", "user": {"password_expires_at": null, "domain": {"id": "default", "name": "Default"}, "id": "6e2553b2b3494f2c9646c41cf64d7d24", "name": "demo"}}}"
Exception in thread "main" java.util.NoSuchElementException: No endpoints were found in the service catalog. Make sure your authentication token has the right scopes and permissions
	at org.jclouds.openstack.keystone.catalog.suppliers.LocationIdToURIFromServiceEndpointsForTypeAndVersion.get(LocationIdToURIFromServiceEndpointsForTypeAndVersion.java:78)
	at org.jclouds.openstack.keystone.catalog.suppliers.LocationIdToURIFromServiceEndpointsForTypeAndVersion.get(LocationIdToURIFromServiceEndpointsForTypeAndVersion.java:46)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:75)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
	at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:150)
	at org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:45)
	at org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:33)
	at com.google.common.base.Suppliers$SupplierComposition.get(Suppliers.java:67)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:75)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
	at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:150)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.getInstanceOfTypeWithQualifier(DelegatesToInvocationFunction.java:277)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.lookupValueFromGuice(DelegatesToInvocationFunction.java:234)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:152)
	at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
	at com.sun.proxy.$Proxy60.getConfiguredRegions(Unknown Source)
	at jclouds_swift.jclouds.swift.test.<init>(test.java:51)
	at jclouds_swift.jclouds.swift.test.main(test.java:23)

最后将代码中加入以下代码行后,才能运行出结果:
在这里插入图片描述
最终结果为:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值