连接到S3存储桶

时间:2016-06-30 07:15:13

标签: java amazon-web-services exception amazon-s3 illegalargumentexception

我有两个相同代码的实例,它在一个单独的代码段中工作,该代码片段监视一个目录&使用以下格式的凭证将文件上传到我的s3存储桶:

access_keyID =prop.getProperty("access_keyID");

secret_access_key =prop.getProperty("secret_access_key");

AWSCredentials credentials = new BasicAWSCredentials(access_keyID,secret_access_key);

//S3 Client Creation

AmazonS3 s3client = new AmazonS3Client(credentials);

但是当我将它集成到我的主项目&用它来将项目的各个输出文件传输到S3存储桶:

String access_keyID = Worker.access_keyID;

String secret_access_key = Worker.secret_access_key;

AWSCredentials credentials = new BasicAWSCredentials(access_keyID, secret_access_key);

//S3 Client Creation

 AmazonS3 s3client = new AmazonS3Client(credentials);

以下为例外:

com.rabbitmq.client.impl.DefaultExceptionHandler: Consumer main.Worker$1@4bdae4da (amq.ctag-nFwSx5gpuh3V7OlfkF8Xow) method handleDelivery for channel AMQChannel(amqp://new@127.0.0.1:5672/,1) threw an exception for channel AMQChannel(amqp://new@127.0.0.1:5672/,1):
java.lang.ExceptionInInitializerError
    at com.amazonaws.util.VersionInfoUtils.userAgent(VersionInfoUtils.java:139)
    at com.amazonaws.util.VersionInfoUtils.initializeUserAgent(VersionInfoUtils.java:134)
    at com.amazonaws.util.VersionInfoUtils.getUserAgent(VersionInfoUtils.java:95)
    at com.amazonaws.ClientConfiguration.<clinit>(ClientConfiguration.java:42)
    at com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:345)
    at push.AWSFileUpload.fileUpload(AWSFileUpload.java:54)
    at rabbit.Cloudflare_Client.client(Cloudflare_Client.java:179)
    at main.Worker$1.handleDelivery(Worker.java:92)
    at com.rabbitmq.client.impl.ConsumerDispatcher$5.run(ConsumerDispatcher.java:144)
    at com.rabbitmq.client.impl.ConsumerWorkService$WorkPoolRunnable.run(ConsumerWorkService.java:99)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException
    at com.amazonaws.internal.config.InternalConfig.loadfrom(InternalConfig.java:199)
    at com.amazonaws.internal.config.InternalConfig.load(InternalConfig.java:217)
    at com.amazonaws.internal.config.InternalConfig$Factory.<clinit>(InternalConfig.java:252)
    ... 13 more

试过&amp;将每个重要的jar替换为与单个代码段相同,仍然无法正常工作。任何有用的帮助都会受到很多关注,因为我的想法已经用完了。

由于

0 个答案:

没有答案