【问题标题】:ObjectStore Bluemix connection javaObjectStore Bluemix 连接 java
【发布时间】:2016-09-30 19:37:18
【问题描述】:

我正在尝试连接到 Bluemix 中的对象存储服务。但是,我不断收到异常。这是我的代码:

 public static void main(String[] args){
     SwiftApi swiftApi;

     String endpoint   = "https://identity.open.softlayer.com/v2.0";
     String tenantName = "object_storage_aedba606_1c69_4a54_b12c_2cecxxxxxx";
     String userName   = "e8ee36a1fa38432abcxxxxxxx";
     String password   = "Y6R(cY3xxxxxxxx";
     String identity = tenantName+":"+userName;
     String provider = "openstack-swift";
     String region = "dallas";
      Properties overrides=new Properties();
         overrides.setProperty(Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO, "true");
     swiftApi = ContextBuilder.newBuilder(provider)
             .endpoint(endpoint)
             .credentials(identity, password)
             .overrides(overrides)
             .buildApi(SwiftApi.class);

     System.out.println("List Containers");

     ContainerApi containerApi = swiftApi.getContainerApi(region);
     Set<Container> containers = containerApi.list().toSet();

     System.out.println("Listing Containers: ");

     for (Container container : containers) {
         System.out.println("  " + container);
     }
     System.out.println(" ");
 }

我不断收到以下异常:

 Exception in thread "main" org.jclouds.rest.AuthorizationException: request: 
 POST https://identity.open.softlayer.com/v2.0/tokens HTTP/1.1  [Sensitive data in payload, 
 use PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO override to enable logging this data.] 
 failed with response: HTTP/1.1 401 Unauthorized
     at org.jclouds.openstack.swift.v1.handlers.SwiftErrorHandler.handleError
 (SwiftErrorHandler.java:52)
     at org.jclouds.http.handlers.DelegatingErrorHandler.handleError
 (DelegatingErrorHandler.java:65)
     at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue
 (BaseHttpCommandExecutorService.java:136)

我的应用程序是一个独立的 Java 应用程序。我正在使用 Bluemix 的对象存储服务中提供的凭据。

非常感谢任何帮助。

【问题讨论】:

    标签: java frameworks ibm-cloud object-storage


    【解决方案1】:

    【讨论】:

    • 谢谢,我最终放弃了 jclouds 实现并改用 OpenStack4J,如上面的答案中所述。这是一种耻辱,但我可以让事情正常工作的唯一方法。再次感谢
    猜你喜欢
    • 2017-05-19
    • 2017-11-24
    • 1970-01-01
    • 2017-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-02
    相关资源
    最近更新 更多