2011-08-12 75 views
1

我們有幾個廣泛使用S3的Android應用程序。我們使用Android SDK中的TranferManager類將文件上傳到S3。它說:「E/HttpClient(6081):com.amazonaws.AmazonClientException:無法初始化XMLReader的一個sax驅動程序」Android s3 SDK:使用TransferManager類上傳大文件失敗

我們已經嘗試使用0.1.0和0.2.1版本的SDK,並且都是在大型(200MB +)上傳中提供相同的問題。

以下是我們的代碼片段:

ObjectMetadata attMetaData = new ObjectMetadata(); 
attMetaData.setContentLength(attachment.getFileSize());                        
TransferManager tm = new TransferManager(Utility.getInstance().getAWSInstance(OutboxService.this)); 
Transfer myUpload = tm.upload(Constants.S3.BUCKET, Attachment.mediaFolders.get(attachment.getFileType())+ attachment.getFileName(), is, attMetaData); 

異常日誌:

W/HttpMethodBase(6081): Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended. 
D/dalvikvm(6081): GC_FOR_MALLOC freed 10875 objects/636320 bytes in 61ms 
D/NativeCrypto(6081): Freeing OpenSSL session 
D/NativeCrypto(6081): Freeing OpenSSL session 
E/HttpClient(6081): Unable to unmarshall response (Couldn't initialize a sax driver for the XMLReader): <?xml version="1.0" encoding="UTF-8"?> 
E/HttpClient(6081): <InitiateMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Bucket>ltd_avmessaging</Bucket><Key>videos/2498992-1313049697.3gp</Key> <UploadId>Tv397TYchM_.U_JDE7PyQcF21lyrtQ7jZYoFG08PgRt07YPn6f_LxlRHVSneGxfdFkGktBs9bIBCA.hAdRb88g--</UploadId></InitiateMultipartUploadResult> 
E/HttpClient(6081): com.amazonaws.AmazonClientException: Couldn't initialize a sax driver for the XMLReader 
E/HttpClient(6081): at com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.<init>(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.model.transform.Unmarshallers$InitiateMultipartUploadResultUnmarshaller.unmarshall(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.model.transform.Unmarshallers$InitiateMultipartUploadResultUnmarshaller.unmarshall(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.internal.S3XmlResponseHandler.handle(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.internal.S3XmlResponseHandler.handle(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.http.HttpClient.handleResponse(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.http.HttpClient.executeHelper(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.http.HttpClient.execute(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.AmazonS3Client.initiateMultipartUpload(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.transfer.internal.MultipartUploadCallable.initiateMultipartUpload(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.transfer.internal.MultipartUploadCallable.call(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.transfer.internal.MultipartUploadCallable.call(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.transfer.internal.TransferStateUpdatingCallable.call(Unknown Source) 
E/HttpClient(6081): at com.amazonaws.services.s3.transfer.internal.TransferStateUpdatingCallable.call(Unknown Source) 
E/HttpClient(6081): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 
E/HttpClient(6081): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 

E/HttpClient的(6081):在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java: 1068) E/HttpClient的(6081):在java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:561) E/HttpClient的(6081):在java.lang.Thread.run(Thread.java: 1102)

回答