title: java.lang.IllegalAccessError Error while reading AWS S3 configuration from Java
body: <p>I am getting below error when trying to access the configuration from Java.</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.apache.hadoop.metrics2.lib.MutableCounterLong.&lt;init&gt;(Lorg/apache/hadoop/metrics2/MetricsInfo;J)V from class org.apache.hadoop.fs.s3a.S3AInstrumentation
      at org.apache.hadoop.fs.s3a.S3AInstrumentation.streamCounter(S3AInstrumentation.java:164)
      at org.apache.hadoop.fs.s3a.S3AInstrumentation.streamCounter(S3AInstrumentation.java:186)
      at org.apache.hadoop.fs.s3a.S3AInstrumentation.&lt;init&gt;(S3AInstrumentation.java:113)
      at org.apache.hadoop.fs.s3a.S3AFileSystem.initialize(S3AFileSystem.java:199)
      at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2596)
      at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:91)
      at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2630)
      at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2612)
      at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:370)
      at MyProgram.GetHiveTableData(MyProgram.java:710)
      at MyProgram$1.run(MyProgram.java:674)
      at MyProgram$1.run(MyProgram.java:670)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:422)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
      at MyProgram.GetHiveTableDetails(MyProgram.java:670)
      at MyProgram.main(MyProgram.java:398)
  </code></pre>
  
  <p>The Code line is </p>
  
  <pre><code>FileSystem hdfs = FileSystem.get(new URI(uriStr), configuration);
  </code></pre>
  
  <p>uriStr=s3a://sBucketName</p>
  
  <p><em>Confurations are set as below for S3A</em></p>
  
  <pre><code>fs.default.name=fs.defaultFS
  fs.defaultFS=s3a://bucketName
  sPath: XXXXXX
  fs.s3a.impl=org.apache.hadoop.fs.s3a.S3AFileSystem
  fs.s3a.access.key=XXXXXX
  fs.s3a.secret.key=XXXXXXX
  fs.s3a.endpoint=XXXXXXX
  hadoop.rpc.protection=privacy
  dfs.data.transfer.protection=privacy
  hadoop.security.authentication=Kerberos
  dfs.namenode.kerberos.principal=hdfs/XXXX@XXXX.XXX.XXXXXX.XXX
  yarn.resourcemanager.principal=yarn/XXXX@XXXX.XXX.XXXXXX.XXX
  </code></pre>
  
  <p>Am I missing anything in configuration setup?
  Please advise.</p>