无法使用Java DSL骆驼组件连接到Amazon S3客户端

时间:2019-04-04 21:01:54

标签: amazon-s3 apache-camel

Not able to connect to s3 using java dsl. 

    XML:    
<bean id="aWSCredentialsProvider" class="com.amazonaws.auth.BasicAWSCredentials">
    <constructor-arg name="accessKey" value="user1"></constructor-arg>
    <constructor-arg name="secretKey" value="xxxxO0Vh"></constructor-arg>
</bean>

<bean id="clientConfiguration" class="com.amazonaws.ClientConfiguration">
    <property name="protocol" value="HTTP"/>
    <property name="proxyHost" value="eos-qa.xxx.com"/>
    <property name="proxyPort" value="9020"/>
</bean>

<bean id="amazonS3Client" class="com.amazonaws.services.s3.AmazonS3Client">
    <constructor-arg name="awsCredentials" ref="aWSCredentialsProvider"></constructor-arg>
    <constructor-arg name="clientConfiguration" ref="clientConfiguration"></constructor-arg>
    <property name="endpoint" value="http://eos-qaxx.com:9020"/>
</bean>

    Java Route:    
from("file://input?fileName=BIS2GIS_IXG_6.XML&noop=true")
    .routeId("FileStorageRouteId")
    .setHeader(S3Constants.CONTENT_LENGTH, simple("36790"))
    .setHeader("CamelAwsS3Key").simple("BIS2GIS_IXG_6.XML")
    .to("aws-s3://fdb-bucket"
            + "?amazonS3Client=#amazonS3Client"
            + "&region=eu-west-1")
    .log("done.");       

/ * com.amazonaws.services.s3.model.AmazonS3Exception:当用户发送格式错误的xml(与发布的xsd不符的xml)时,就会发生这种情况。错误消息是:“您提供的XML格式不正确或未针对我们发布的架构进行验证。” (服务:Amazon S3;状态代码:400;错误代码:MalformedXML;请求ID:0a1d2f16:16892c3dac5:83dd9:14e),S3扩展请求ID:null             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1630)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.executeOneRequest(AmazonHttpClient.java:1302)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.executeHelper(AmazonHttpClient.java:1056)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.doExecute(AmazonHttpClient.java:743)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.execute(AmazonHttpClient.java:699)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.access $ 500(AmazonHttpClient.java:667)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)             在com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)             在com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4187)             在com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4134)             在com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1720)             在org.apache.camel.component.aws.s3.S3Producer.processSingleOp(S3Producer.java:236)             在org.apache.camel.component.aws.s3.S3Producer.process(S3Producer.java:85)             在org.apache.camel.util.AsyncProcessorConverterHelper $ ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)             在org.apache.camel.processor.SendDynamicProcessor $ 1.doInAsyncProducer(SendDynamicProcessor.java:124)中             在org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:436)             在org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:119)             在org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)             在org.apache.camel.processor.interceptor.HandleFaultInterceptor.process(HandleFaultInterceptor.java:42)             在org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:110)             在org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)             在org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)             在org.apache.camel.processor.Pipeline.process(Pipeline.java:120)             在org.apache.camel.processor.Pipeline.process(Pipeline.java:83)             在org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)             在org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:298)             在org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:207)             在org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:154)             在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)             在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)             在java.lang.Thread.run(Thread.java:745)         2019-04-04 13:36:13,965警告-错误处理交换。交换[]。引起原因:[com.amazonaws.services.s3.model.AmazonS3Exception-当用户发送格式错误的xml(不符合已发布的xsd的xml)进行配置时,就会发生这种情况。错误消息是:“您提供的XML格式不正确或未针对我们发布的架构进行验证。” (服务:Amazon S3;状态代码:400;错误代码:MalformedXML;请求ID:0a1d2f16:16892c3dac5:83dd9:14e)]         com.amazonaws.services.s3.model.AmazonS3Exception:当用户发送格式错误的xml(与发布的xsd不符的xml)时,就会发生这种情况。错误消息是:“您提供的XML格式不正确或未针对我们发布的架构进行验证。” (服务:Amazon S3;状态代码:400;错误代码:MalformedXML;请求ID:0a1d2f16:16892c3dac5:83dd9:14e),S3扩展请求ID:null             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1630)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.executeOneRequest(AmazonHttpClient.java:1302)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.executeHelper(AmazonHttpClient.java:1056)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.doExecute(AmazonHttpClient.java:743)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.execute(AmazonHttpClient.java:699)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutor.access $ 500(AmazonHttpClient.java:667)             在com.amazonaws.http.AmazonHttpClient $ RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)             在com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)             在com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4187)             在com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4134)             在com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1720)             在org.apache.camel.component.aws.s3.S3Producer.processSingleOp(S3Producer.java:236)             在org.apache.camel.component.aws.s3.S3Producer.process(S3Producer.java:85)             在org.apache.camel.util.AsyncProcessorConverterHelper $ ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)             在org.apache.camel.processor.SendDynamicProcessor $ 1.doInAsyncProducer(SendDynamicProcessor.java:124)中             在org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:436)             在org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:119)             在org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)             在org.apache.camel.processor.interceptor.HandleFaultInterceptor.process(HandleFaultInterceptor.java:42)             在org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:110)             在org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)             在org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)             在org.apache.camel.processor.Pipeline.process(Pipeline.java:120)             在org.apache.camel.processor.Pipeline.process(Pipeline.java:83)             在org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)             在org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:298)             在org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:207)             在org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:154)             在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)             在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)             在java.lang.Thread.run(Thread.java:745)* /

0 个答案:

没有答案