我正在尝试使用本地计算机上的Tomcat 7将文件上传到Amazon S3。我在尝试创建AmazonS3Client时遇到错误。相同的代码在桌面应用程序中运行良好。
String existingBucketName = "namebucket";
String keyName = "test.txt";
String filePath = "C://test.txt";
AWSCredentials credentials = new BasicAWSCredentials("****","*********");
AmazonS3 s3Client = new AmazonS3Client(credentials);
File file = new File(filePath);
s3Client.putObject(new PutObjectRequest(existingBucketName, keyName, file));