Tag: 亚马逊

AmazonClientException:数据读取的长度与预期的不同

1.当我使用AmazonS3Client在amazon s3文件存储上传文件时。 2.当我尝试一次上传多个文件时,它会提供exception:但是同一个文件有多个线程。 我尝试了客户端配置,例如:1.connectionTimeout = 50000 in ms 2.maxConnections = 500 3.socketTimeout = 50000 in ms Exception stacktrace: com.amazonaws.AmazonClientException: Data read has a different length than the expected: dataLength=8192; expectedLength=79352; includeSkipped=false; in.getClass()=class com.amazonaws.internal.ResettableInputStream; markedSupported=true; marked=0; resetSinceLastMarked=false; markCount=1; resetCount=0 at com.amazonaws.util.LengthCheckInputStream.checkLength(LengthCheckInputStream.java:150) at com.amazonaws.util.LengthCheckInputStream.read(LengthCheckInputStream.java:110) at com.amazonaws.internal.SdkFilterInputStream.read(SdkFilterInputStream.java:73) at com.amazonaws.event.ProgressInputStream.read(ProgressInputStream.java:151) at com.amazonaws.internal.SdkFilterInputStream.read(SdkFilterInputStream.java:73) at org.apache.http.entity.InputStreamEntity.writeTo(InputStreamEntity.java:98) at com.amazonaws.http.RepeatableInputStreamRequestEntity.writeTo(RepeatableInputStreamRequestEntity.java:153) at org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:98) at […]

Amazon Product Advertising API使用Java签署了请求

经过几个小时的修补和阅读整个互联网几次,我无法弄清楚如何签署使用Product Advertising API的请求。 到目前为止,我设法从提供的WSDL文件生成客户端。 我使用了亚马逊的教程。 你可以在这里找到它: 生成Web服务客户端的教程 到目前为止没有问题。 为了测试客户端,我写了一小段代码。 该代码旨在简单地获取有关产品的一些信息。 该产品由其ASIN指定。 代码: package client; import com.ECS.client.jax.AWSECommerceService; import com.ECS.client.jax.AWSECommerceServicePortType; import com.ECS.client.jax.ItemLookup; import com.ECS.client.jax.ItemLookupResponse; import com.ECS.client.jax.ItemLookupRequest; public class Client { public static void main(String[] args) { System.out.println(“API Test startet”); AWSECommerceService service = new AWSECommerceService(); AWSECommerceServicePortType port = service.getAWSECommerceServicePort(); ItemLookupRequest itemLookup = new ItemLookupRequest(); itemLookup.setIdType(“ASIN”); itemLookup.getItemId().add(“B000RE216U”); ItemLookup lookup […]

如何使用纯Java生成Parquet文件(包括日期和小数类型)并上传到S3 (无HDFS)

我最近有一个要求,我需要生成Parquet文件,Apache Spark只能使用Java读取(不使用其他软件安装,如:Apache Drill,Hive,Spark等)。 这些文件需要保存到S3,因此我将分享有关如何执行这两项操作的详细信息。 关于如何做到这一点没有简单的指南。 我也不是Java程序员,因此使用Maven,Hadoop等的概念对我来说都是陌生的。 所以我花了将近两周的时间来完成这项工作。 我想在下面分享我的个人指南,了解我是如何实现这一目标的