所以这是一个很好的,我会喜欢一些帮助.
这是我得到的错误
getS3Client(): Exception: java.lang.NoSuchMethodError: org.apache.http.impl.conn.CPool.setValidateAfterInactivity(I)V
当我尝试运行这段代码时
GrailsApplication grailsApplication
// Amazon AWS S3 properties
private awsProps = [ "loaded" : false
, "S3Bucket" : ""
, "AccessKeyId" : ""
, "AccessKeyPsw": ""
]
def getS3Client ( ) {
try {
if ( ! awsProps.loaded ) {
loadAwsProperties()
}
def awsCreds = new BasicAWSCredentials( awsProps.AccessKeyId, awsProps.AccessKeyPsw )
AmazonS3 s3Client
s3Client = AmazonS3ClientBuilder.standard()
.withCredentials( new AWSStaticCredentialsProvider( awsCreds ) )
.withRegion( Regions.US_EAST_1 )
.build()
return s3Client
} catch ( Throwable t ) { …Run Code Online (Sandbox Code Playgroud)