java.lang.NoSuchMethodError:com.amazonaws.services.s3.transfer.TransferManager。<init>(Lcom / amazonaws / services / s3 / transfer / TransferManagerParams

时间:2019-06-03 12:57:53

标签: java amazon-s3

我目前正在尝试使用TransferManagerBuilder上传到本地s3存储,但是我遇到了以下错误:

由以下原因导致:java.lang.NoSuchMethodError:com.amazonaws.services.s3.transfer.TransferManager。(Lcom / amazonaws / services / s3 / transfer / TransferManagerParams;)V

以下是我正在使用的代码:

  AmazonS3 s3ClientConnection = AmazonUtils.createS3Client(s3AccessKey, 
  s3SecretKey, s3EndpointUrl, null);

  int maxUploadThreads = 5;

  TransferManager tm = TransferManagerBuilder
      .standard()
      .withS3Client(s3ClientConnection)
      .withMultipartUploadThreshold((long) (5 * 1024 * 1024))
      .withExecutorFactory(() -> Executors.newFixedThreadPool(maxUploadThreads))
      .build();

  ProgressListener progressListener = progressEvent -> System.out.println(
      "Transferred bytes: " + progressEvent.getBytesTransferred());
  PutObjectRequest request = new PutObjectRequest(bucket, path, input,
      objectMetadata).withCannedAcl(acl);
  request.setGeneralProgressListener(progressListener);
  Upload upload = tm.upload(request);

当到达.build()时,代码会中断,我不确定为什么吗?使用TransferManagerBuilder类时,使用本地s3存储是否存在兼容性问题?

0 个答案:

没有答案