title: Unable to connect Google Storage file using GSC connector from Spark
body: <p>I have written a spark job on my local machine which reads the file from google cloud storage using google hadoop connector like <strong>gs://storage.googleapis.com/</strong> as mentioned in <a href="https://cloud.google.com/dataproc/docs/connectors/cloud-storage" rel="noreferrer">https://cloud.google.com/dataproc/docs/connectors/cloud-storage</a></p>
  
  <p>I have set up <strong>service account</strong> with compute engine and storage permissions. 
  My spark configuration and code is </p>
  
  <pre><code>SparkConf conf = new SparkConf();
  conf.setAppName("SparkAPp").setMaster("local");
  conf.set("google.cloud.auth.service.account.enable", "true");
  conf.set("google.cloud.auth.service.account.email", "xxx-compute@developer.gserviceaccount.com");
  conf.set("google.cloud.auth.service.account.keyfile", "/root/Documents/xxx-compute-e71ddbafd13e.p12");
  conf.set("fs.gs.project.id", "xxx-990711");
  conf.set("fs.gs.impl", "com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem");
  conf.set("fs.AbstractFileSystem.gs.impl", "com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem"); 
  
  SparkContext sparkContext = new SparkContext(conf);
  JavaRDD&lt;String&gt; data = sparkContext.textFile("gs://storage.googleapis.com/xxx/xxx.txt", 0).toJavaRDD();
  data.foreach(line -&gt; System.out.println(line));
  </code></pre>
  
  <p>I have set up environment variable also named <strong>GOOGLE_APPLICATION_CREDENTIALS</strong> which points to the key file. I have tried using both key files i.e. <strong>json</strong> &amp; <strong>P12</strong>. But unable to access the file.
  The error which I get is </p>
  
  <pre><code>java.net.UnknownHostException: metadata
  java.io.IOException: Error getting access token from metadata server at: http://metadata/computeMetadata/v1/instance/service-accounts/default/token
          at com.google.cloud.hadoop.util.CredentialFactory.getCredentialFromMetadataServiceAccount(CredentialFactory.java:208)
          at com.google.cloud.hadoop.util.CredentialConfiguration.getCredential(CredentialConfiguration.java:70)
  </code></pre>
  
  <p>I am running my job from eclipse with java 8, spark 2.2.0 dependencies and <strong>gcs-connector 1.6.1.hadoop2</strong> .
  I need to connect only using service account and not by OAuth mechanism.</p>
  
  <p>Thanks in advance</p>