java.security.InvalidAlgorithmParameterException while jClouds MS Azure Blob put operation

StackOverflow https://stackoverflow.com/questions/17763326

문제

I am facing issue with jClouds AzureBlob API with put operation

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);

I am setting primary access key from manage access key -> Primary access key for my storage account.

It gives me following error

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)

In above stack trace "ERROR/error_20130717022518962.xml " is the file I am trying to put on the blob storage.

Any clue, how to resolve this?

도움이 되었습니까?

해결책

This issue has been resolved, actually code which is invoking ReST PUT for azure blob storage. was somehow not able to load java default trust-store.

By adding below line to load default cacert

System.setProperty("javax.net.ssl.trustStore",PATH_TO_CACERT);
System.setProperty("javax.net.ssl.trustStorePassword",PASSWORD);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top