jClouds MS Azure Blob放置操作时java.security.InvalidAlgorithmParameterException

时间:2013-07-20 14:40:54

标签: java azure-storage-blobs jclouds

我面临着使用put操作

的jClouds AzureBlob API的问题
context = new BlobStoreContextFactory().createContext(
                    this.storageType,
                    this.storageAccount, 
                    this.primaryAccessKey);

    BlobStore blobStore = context.getBlobStore();
                Blob blob = blobStore.blobBuilder(fileName).payload(content).build(); //$NON-NLS-1$
                blobStore.putBlob(this.containerName, blob);

我正在设置来自管理访问密钥的主要访问密钥 - >我的存储帐户的主要访问密钥。

它给了我以下错误

org.jclouds.http.HttpResponseException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty connecting to PUT https://mypackages.blob.core.windows.net/mycontainer/ERROR/error_20130717022518962.xml HTTP/1.1
    at org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallable.call(BaseHttpCommandExecutorService.java:173)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallable.call(BaseHttpCommandExecutorService.java:130)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_43]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_43]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)[:1.6.0_43]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)[:1.6.0_43]
    at java.lang.Thread.run(Thread.java:662)[:1.6.0_43]
    at org.jclouds.concurrent.config.ExecutorServiceModule$DescribingExecutorService.submit(ExecutorServiceModule.java:184)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService.submit(BaseHttpCommandExecutorService.java:127)
    at org.jclouds.http.TransformingHttpCommandExecutorServiceImpl.submit(TransformingHttpCommandExecutorServiceImpl.java:54)
    at org.jclouds.http.TransformingHttpCommandImpl.execute(TransformingHttpCommandImpl.java:73)
    at org.jclouds.rest.internal.AsyncRestClientProxy.createListenableFutureForHttpRequestMappedToMethodAndArgs(AsyncRestClientProxy.java:198)
    at org.jclouds.rest.internal.AsyncRestClientProxy.invoke(AsyncRestClientProxy.java:134)
    at com.sun.proxy.$Proxy295.putBlob(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor107.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_43]
    at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_43]
    at org.jclouds.concurrent.internal.SyncProxy.invoke(SyncProxy.java:137)
    at com.sun.proxy.$Proxy296.putBlob(Unknown Source)
    at org.jclouds.azureblob.blobstore.AzureBlobStore.putBlob(AzureBlobStore.java:194)
    at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_43]
    at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_43]
    at com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:37)
    at com.sun.proxy.$Proxy287.putBlob(Unknown Source)

在上面的堆栈跟踪中,“ERROR / error_20130717022518962.xml”是我试图放在Blob存储上的文件。

有任何线索,如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

此问题已得到解决,实际上是为天蓝色blob存储调用ReST PUT的代码。 以某种方式无法加载java默认信任库。

通过添加以下行来加载默认的cacert

System.setProperty("javax.net.ssl.trustStore",PATH_TO_CACERT);
System.setProperty("javax.net.ssl.trustStorePassword",PASSWORD);