0

I tried setting up a BigQuery project with a JAVA API to access it. But when I run the google BigQueryInstalledAuthDemo class which is here, I get this error :

java.lang.NullPointerException

at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
at com.google.api.client.json.jackson.JacksonFactory.createJsonParser(JacksonFactory.java:70)
at com.google.api.client.json.JsonFactory.fromInputStream(JsonFactory.java:223)
at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.load(GoogleClientSecrets.java:167)
at BigQueryLocal.loadClientSecrets(BigQueryLocal.java:99)
at BigQueryLocal.<clinit>(BigQueryLocal.java:31)
 Exception in thread "main" java.lang.NullPointerException
at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl.   <init>(GoogleAuthorizationCodeRequestUrl.java:111)
at BigQueryLocal.main(BigQueryLocal.java:47)

Which I don't understand, my JSON file is in the same folder than the class (I tried both relative and absolute paths) My JSON file is like this :

{
     "installed": {
        "client_id": "XXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com",
        "client_secret": "XXXXXXXXXXXXXXXXX",
        "redirect_uris": ["urn:ietf:oauth:2.0:oob"],
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://accounts.google.com/o/oauth2/token"
    }
}

I use the google API library 1.12-beta and java 1.6. So, I don't understand why I have this error right there :(, so if anyone has an idea...

Thank you :)

j0k
  • 22,600
  • 28
  • 79
  • 90
  • Can you tell me how to find out my Client Secret of my Google Drive project. I got my client id but i don't know where to get Client secret. please help me, – Pir Fahim Shah Mar 20 '14 at 06:49

1 Answers1

0

Which IDE are you using? This tends to happen when your code can't locate the resource, because it is in the wrong directory, or is in a directory that your app doesn't consider a resource.

There's a lot of info on Stack Overflow about handling this, for example: Where to put a textfile I want to use in eclipse?

Community
  • 1
  • 1
Michael Manoochehri
  • 7,931
  • 6
  • 33
  • 47
  • Thank you ! I was trying to use it as a normal file at the root of the project when it should have been in the class package. I didn't really know what to search, sorry :/ – Valentin D. Nov 08 '12 at 02:44