在Spring MVC应用程序中使用jclouds创建BlobContext时出错 [英] Error creating BlobContext using jclouds in a Spring MVC application

查看:107
本文介绍了在Spring MVC应用程序中使用jclouds创建BlobContext时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Spring MVC 4.0.1 Web应用程序,需要将文件上传到Rackspace Cloud Files.我正在使用Apache jClouds来做到这一点.尝试使用以下代码创建BlobStore时:

I have a Spring MVC 4.0.1 web application that needs to upload files to Rackspace Cloud Files. I am using Apache jClouds in order to do this. When trying to create the BlobStore using the following code:

BlobStoreContext context = ContextBuilder.newBuilder("cloudfiles-us").credentials("username","password").buildView(BlobStoreContext.class);

我收到以下异常:

com.google.inject.CreationException: Guice creation errors:

1) No implementation for com.google.common.base.Supplier<java.lang.String> annotated with @org.jclouds.openstack.swift.TemporaryUrlKey() was bound.
  while locating com.google.common.base.Supplier<java.lang.String> annotated with @org.jclouds.openstack.swift.TemporaryUrlKey()
    for parameter 4 at org.jclouds.openstack.swift.blobstore.SwiftBlobSigner.<init>(SwiftBlobSigner.java:88)
  at org.jclouds.cloudfiles.CloudFilesApiMetadata$CloudFilesTemporaryUrlExtensionModule.bindRequestSigner(CloudFilesApiMetadata.java:101)

2) No implementation for org.jclouds.openstack.swift.CommonSwiftClient was bound.
  while locating org.jclouds.openstack.swift.CommonSwiftClient
    for parameter 4 at org.jclouds.cloudfiles.blobstore.CloudFilesBlobStore.<init>(CloudFilesBlobStore.java:63)
  at org.jclouds.cloudfiles.blobstore.config.CloudFilesBlobStoreContextModule.configure(CloudFilesBlobStoreContextModule.java:64)

3) No implementation for org.jclouds.openstack.swift.CommonSwiftClient was bound.
  while locating org.jclouds.openstack.swift.CommonSwiftClient
    for parameter 0 at org.jclouds.openstack.swift.blobstore.strategy.internal.SequentialMultipartUploadStrategy.<init>(SequentialMultipartUploadStrategy.java:51)
  while locating com.google.inject.Provider<org.jclouds.openstack.swift.blobstore.strategy.internal.MultipartUploadStrategy>
    for parameter 14 at org.jclouds.cloudfiles.blobstore.CloudFilesBlobStore.<init>(CloudFilesBlobStore.java:63)
  at org.jclouds.cloudfiles.blobstore.config.CloudFilesBlobStoreContextModule.configure(CloudFilesBlobStoreContextModule.java:64)

4) org.jclouds.rest.config.SyncToAsyncHttpApiProvider<org.jclouds.openstack.keystone.v1_1.AuthenticationClient, A> cannot be used as a key; It is not fully specified.

5) org.jclouds.rest.config.SyncToAsyncHttpApiProvider<org.jclouds.rest.HttpClient, A> cannot be used as a key; It is not fully specified.

6) org.jclouds.rest.config.SyncToAsyncHttpApiProvider<org.jclouds.cloudfiles.CloudFilesClient, A> cannot be used as a key; It is not fully specified.

7) org.jclouds.rest.config.SyncToAsyncHttpApiProvider<org.jclouds.openstack.swift.extensions.TemporaryUrlKeyApi, A> cannot be used as a key; It is not fully specified.

8) org.jclouds.rest.RestContext<org.jclouds.cloudfiles.CloudFilesClient, A> cannot be used as a key; It is not fully specified.

9) No implementation for org.jclouds.location.suppliers.RegionIdToURISupplier$Factory was bound.
  at org.jclouds.cloudfiles.config.CloudFilesRestClientModule$StorageAndCDNManagementEndpointModule.provideCDNUrl(CloudFilesRestClientModule.java:67)

10) No implementation for org.jclouds.openstack.keystone.v1_1.suppliers.V1DefaultRegionIdSupplier$Factory was bound.
  at org.jclouds.cloudfiles.config.CloudFilesRestClientModule$StorageAndCDNManagementEndpointModule.provideCDNUrl(CloudFilesRestClientModule.java:67)

11) No implementation for org.jclouds.location.suppliers.RegionIdToURISupplier$Factory was bound.
  at org.jclouds.cloudfiles.config.CloudFilesRestClientModule$StorageAndCDNManagementEndpointModule.provideStorageUrl(CloudFilesRestClientModule.java:76)

12) No implementation for org.jclouds.openstack.keystone.v1_1.suppliers.V1DefaultRegionIdSupplier$Factory was bound.
  at org.jclouds.cloudfiles.config.CloudFilesRestClientModule$StorageAndCDNManagementEndpointModule.provideStorageUrl(CloudFilesRestClientModule.java:76)

13) No implementation for org.jclouds.openstack.keystone.v1_1.AuthenticationClient was bound.
  at org.jclouds.rest.config.BinderUtils.bindHttpApiProvider(BinderUtils.java:106)

14) No implementation for org.jclouds.rest.HttpClient was bound.
  at org.jclouds.rest.config.BinderUtils.bindHttpApiProvider(BinderUtils.java:106)

15) No implementation for org.jclouds.cloudfiles.CloudFilesClient was bound.
  at org.jclouds.rest.config.BinderUtils.bindHttpApiProvider(BinderUtils.java:106)

16) No implementation for org.jclouds.openstack.swift.extensions.TemporaryUrlKeyApi was bound.
  at org.jclouds.rest.config.BinderUtils.bindHttpApiProvider(BinderUtils.java:106)

16 errors

我无法弄清楚,因为这几乎是示例代码的第一行...

I cannot figure this out, since its pretty much the first line of the example code at this point...

推荐答案

您是否正在使用Java 7u51运行jclouds 1.6.x或1.7.0?如果是这样,您可能已经遇到 https://issues.apache.org/jira/browse/JCLOUDS-427 .您可以通过降级到Java 7u45或升级到jclouds 1.7.1来解决此问题.

Are you running jclouds 1.6.x or 1.7.0 with Java 7u51? If so, you may have encountered https://issues.apache.org/jira/browse/JCLOUDS-427 . You can work around this by downgrading to Java 7u45 or upgrading to jclouds 1.7.1.

这篇关于在Spring MVC应用程序中使用jclouds创建BlobContext时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆