我正在像这样在 java 中使用 AWS SDK 2.x 创建 KinesisClient 类的对象
AwsCredentialsProvider credentialsProvider = StaticCredentialsProvider.create(
AwsBasicCredentials.create("access-key",
"secret-key")
);
KinesisClient kinesisClient = KinesisClient.builder()
.credentialsProvider(credentialsProvider)
.build();
当我执行这段代码时,我遇到了异常
Exception in thread "main" java.lang.IllegalArgumentException: Expected a profile definition on line 1
at software.amazon.awssdk.utils.Validate.isTrue(Validate.java:76)
at software.amazon.awssdk.profiles.internal.ProfileFileReader.readPropertyDefinitionLine(ProfileFileReader.java:125)
at software.amazon.awssdk.profiles.internal.ProfileFileReader.parseLine(ProfileFileReader.java:78)
at software.amazon.awssdk.profiles.internal.ProfileFileReader.lambda$parseFile$0(ProfileFileReader.java:58)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
at software.amazon.awssdk.profiles.internal.ProfileFileReader.parseFile(ProfileFileReader.java:58)
at software.amazon.awssdk.profiles.ProfileFile$BuilderImpl.build(ProfileFile.java:265)
at software.amazon.awssdk.profiles.ProfileFile.lambda$addCredentialsFile$0(ProfileFile.java:142)
at java.util.Optional.ifPresent(Optional.java:159)
at software.amazon.awssdk.profiles.ProfileFile.addCredentialsFile(ProfileFile.java:139)
at software.amazon.awssdk.utils.builder.SdkBuilder.applyMutation(SdkBuilder.java:61)
at software.amazon.awssdk.profiles.ProfileFile.defaultProfileFile(ProfileFile.java:90)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.mergeGlobalDefaults(SdkDefaultClientBuilder.java:196)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration(SdkDefaultClientBuilder.java:149)
at software.amazon.awssdk.services.kinesis.DefaultKinesisClientBuilder.buildClient(DefaultKinesisClientBuilder.java:28)
at software.amazon.awssdk.services.kinesis.DefaultKinesisClientBuilder.buildClient(DefaultKinesisClientBuilder.java:22)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:124)
该配置文件是否缺少任何内容,或者还有其他方法可以创建客户端对象。提前致谢!