1

Here is an Example of my code:

    Properties props = new Properties();
    props.setProperty(KeystoneProperties.CREDENTIAL_TYPE, CredentialTypes.API_ACCESS_KEY_CREDENTIALS);
    context = ContextBuilder.newBuilder("hpcloud-objectstorage")
        .overrides(props)
        .credentials(api_key, api_secret)
        .buildView(BlobStoreContext.class);
    store = context.getBlobStore();

    // this works
    Blob blob1 = store.blobBuilder("file1")
        .payload("")
        .build();

    String blobName1 = store.putBlob(remoteFolderName, blob1);

    // this crashes with the message, you can see below
    Blob blob2 = store.blobBuilder("file2")
        .payload("a")
        .build();

    String blobName1 = store.putBlob(remoteFolderName, blob2);

the exception message I get after executing this code is following:

    Nov 07, 2012 7:08:44 PM org.jclouds.logging.jdk.JDKLogger logError
    Schwerwiegend: Cannot retry after server error, command has exceeded retry limit 5: [method=HPCloudObjectStorageAsyncApi.putObject, request=PUT https://region-a.geo-1.objects.hpcloudsvc.com/v1/82797321453196/cloudstoretest/file2 HTTP/1.1]

an here is the stacktrace:

    org.jclouds.http.HttpResponseException: Unexpected end of file from server connecting to PUT https://region-a.geo-1.objects.hpcloudsvc.com/v1/82797321453196/cloudstoretest/tada%21 HTTP/1.1
    at org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallable.call(BaseHttpCommandExecutorService.java:179)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallable.call(BaseHttpCommandExecutorService.java:135)
    ...

I dont have any clue, what the problem could be. I'm searching for 2 days for possible solutions, but without any result. I would be very happy, if someone has an idea, what i am doing wrong...

DiKorsch
  • 1,240
  • 9
  • 20

1 Answers1

0

looks like the name of your blob is literally "tada!" based on the url encoded "tada%21"

it is quite possible that the openstack swift implementation doesn't support blobs with names including a trailing '!'. Can you try other naming conventions and see if you have the same error?

Adrian Cole
  • 792
  • 4
  • 10
  • Sry, “tada!“ is my error trying to edit my code for this post. Ive tried this code with different names, and it doesnt worked. – DiKorsch Nov 19 '12 at 15:40
  • The real problem is when you pass to .payload() a String. I've solved this issue by passing the FileInputStream(of the File, I want to upload) to payload. Now it works. I think, if you pass a string, it will be handled as a file path. – DiKorsch Nov 19 '12 at 15:49