Java 在Spring MVC应用程序中使用jclouds创建BlobContext时出错

Java 在Spring MVC应用程序中使用jclouds创建BlobContext时出错,java,guice,guava,cloudfiles,jclouds,Java,Guice,Guava,Cloudfiles,Jclouds,我有一个SpringMVC4.0.1Web应用程序,需要将文件上载到Rackspace云文件。我使用ApacheJClouds来实现这一点。尝试使用以下代码创建BlobStore时: BlobStoreContext context = ContextBuilder.newBuilder("cloudfiles-us").credentials("username","password").buildView(BlobStoreContext.class); 我得到以下例外情况: com.go

我有一个SpringMVC4.0.1Web应用程序,需要将文件上载到Rackspace云文件。我使用ApacheJClouds来实现这一点。尝试使用以下代码创建BlobStore时:

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
com.google.inject.CreationException:Guice创建错误:
1) 未绑定用@org.jclouds.openstack.swift.TemporaryUrlKey()注释的com.google.common.base.Supplier的实现。
查找com.google.common.base.Supplier时使用@org.jclouds.openstack.swift.TemporaryUrlKey()注释
对于参数4,位于org.jclouds.openstack.swift.blobstore.SwiftBlobSigner.(SwiftBlobSigner.java:88)
位于org.jclouds.cloudfiles.CloudFilesApiMetadata$CloudFilesTemporaryUrlExtensionModule.bindRequestSigner(CloudFilesApiMetadata.java:101)
2) 未绑定org.jclouds.openstack.swift.CommonSwiftClient的实现。
查找org.jclouds.openstack.swift.CommonSwiftClient时
对于参数4,位于org.jclouds.cloudfiles.blobstore.CloudFilesBlobStore.(CloudFilesBlobStore.java:63)
在org.jclouds.cloudfiles.blobstore.config.CloudFilesBlobStoreContextModule.configure(CloudFilesBlobStoreContextModule.java:64)
3) 未绑定org.jclouds.openstack.swift.CommonSwiftClient的实现。
查找org.jclouds.openstack.swift.CommonSwiftClient时
对于参数0,位于org.jclouds.openstack.swift.blobstore.strategy.internal.SequentialMultipartPloadstrategy.(SequentialMultipartPloadstrategy.java:51)
查找com.google.inject.Provider时
对于参数14,位于org.jclouds.cloudfiles.blobstore.CloudFilesBlobStore.(CloudFilesBlobStore.java:63)
在org.jclouds.cloudfiles.blobstore.config.CloudFilesBlobStoreContextModule.configure(CloudFilesBlobStoreContextModule.java:64)
4) org.jclouds.rest.config.SyncToAsyncHttpApiProvider不能用作密钥;它没有完全指定。
5) org.jclouds.rest.config.SyncToAsyncHttpApiProvider不能用作密钥;它没有完全指定。
6) org.jclouds.rest.config.SyncToAsyncHttpApiProvider不能用作密钥;它没有完全指定。
7) org.jclouds.rest.config.SyncToAsyncHttpApiProvider不能用作密钥;它没有完全指定。
8) org.jclouds.rest.RestContext不能用作键;它没有完全指定。
9) 未绑定org.jclouds.location.suppliers.RegionidTourisSupplier$Factory的实现。
位于org.jclouds.cloudfiles.config.CloudFilesRestClientModule$StorageAndCDNManagementEndpointModule.providedecdnurl(CloudFilesRestClientModule.java:67)
10) 未绑定org.jclouds.openstack.keystone.v1_1.suppliers.V1DefaultRegionIdSupplier$Factory的实现。
位于org.jclouds.cloudfiles.config.CloudFilesRestClientModule$StorageAndCDNManagementEndpointModule.providedecdnurl(CloudFilesRestClientModule.java:67)
11) 未绑定org.jclouds.location.suppliers.RegionidTourisSupplier$Factory的实现。
位于org.jclouds.cloudfiles.config.CloudFilesRestClientModule$StorageAndCDNManagementEndpointModule.provideStorageUrl(CloudFilesRestClientModule.java:76)
12) 未绑定org.jclouds.openstack.keystone.v1_1.suppliers.V1DefaultRegionIdSupplier$Factory的实现。
位于org.jclouds.cloudfiles.config.CloudFilesRestClientModule$StorageAndCDNManagementEndpointModule.provideStorageUrl(CloudFilesRestClientModule.java:76)
13) 未绑定org.jclouds.openstack.keystone.v1_1.AuthenticationClient的实现。
位于org.jclouds.rest.config.BinderUtils.bindHttpApiProvider(BinderUtils.java:106)
14) 未绑定org.jclouds.rest.HttpClient的实现。
位于org.jclouds.rest.config.BinderUtils.bindHttpApiProvider(BinderUtils.java:106)
15) 未绑定org.jclouds.cloudfiles.CloudFilesClient的实现。
位于org.jclouds.rest.config.BinderUtils.bindHttpApiProvider(BinderUtils.java:106)
16) 未绑定org.jclouds.openstack.swift.extensions.TemporaryUrlKeyApi的实现。
位于org.jclouds.rest.config.BinderUtils.bindHttpApiProvider(BinderUtils.java:106)
16个错误

我无法理解这一点,因为这几乎是示例代码的第一行…

您是使用Java 7u51运行jclouds 1.6.x还是1.7.0?如果是这样的话,您可能会遇到。您可以通过降级到Java 7u45或升级到jclouds 1.7.1来解决这个问题。

我正在使用Java 7u51。就是这样!