title: How to resolve the error java.lang.NoSuchMethodError: com.amazonaws.SDKGlobalConfiguration.isInRegionOptimizedModeEnabled()Z?
body: <p>I am trying to upload a file to S3 and getting error like</p>
  
  <blockquote>
    <p>Target exception: java.lang.NoSuchMethodError:
    com.amazonaws.SDKGlobalConfiguration.isInRegionOptimizedModeEnabled()Z</p>
  </blockquote>
  
  <p>Code is </p>
  
  <pre><code> String accessKey="accesskey";
   String secretKey="mysecretkey"
  
    AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
    AmazonS3 conn = new AmazonS3Client(credentials);
  </code></pre>
  
  <p>In the line of   <code>AmazonS3 conn = new AmazonS3Client(credentials);</code> I am getting the target exception.</p>
  
  <p>Totally I imported these many java packages showing below. still getting the same error.</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  
  import java.io.ByteArrayInputStream;
  import java.io.File;
  import java.util.List;
  import com.amazonaws.auth.*;
  import com.amazonaws.auth.AWSCredentials;
  import com.amazonaws.auth.BasicAWSCredentials;
  import com.amazonaws.util.StringUtils;
  import com.amazonaws.services.s3.AmazonS3;
  import com.amazonaws.services.s3.AmazonS3Client;
  import com.amazonaws.SDKGlobalConfiguration;
  import com.amazonaws.services.s3.model.Bucket;
  import com.amazonaws.services.s3.model.CannedAccessControlList;
  import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest;
  import com.amazonaws.services.s3.model.GetObjectRequest;
  import com.amazonaws.services.s3.model.ObjectListing;
  import com.amazonaws.services.s3.model.ObjectMetadata;
  import com.amazonaws.services.s3.model.S3ObjectSummary;
  
  import com.amazonaws.services.s3.*;
  import com.amazonaws.services.s3.AmazonS3ClientBuilder;
  import com.amazonaws.services.s3.AmazonS3Builder;
  import com.amazonaws.services.s3.AmazonS3Client;
  import com.amazonaws.services.s3.AmazonS3ClientBuilder;
  import com.amazonaws.ClientConfigurationFactory;
  import com.amazonaws.annotation.NotThreadSafe;
  import com.amazonaws.annotation.SdkTestInternalApi;
  import com.amazonaws.client.AwsSyncClientParams;
  import com.amazonaws.internal.SdkFunction;
  import com.amazonaws.regions.AwsRegionProvider;
  
  import com.amazonaws.ClientConfiguration;
  import com.amazonaws.Protocol;
  import com.amazonaws.AmazonS3Client;
  import com.amazonaws.AmazonClientException;
  import com.amazonaws.AmazonServiceException;
  import com.amazonaws.auth.profile.ProfileCredentialsProvider;
  import com.amazonaws.services.s3.AmazonS3;
  import com.amazonaws.services.s3.AmazonS3Client;
  import com.amazonaws.services.s3.model.PutObjectRequest;
  </code></pre>