1

I am trying to fetch access token and refresh token using the document specified here. While doing so, I am faced with an issue:

java.lang.NoSuchMethodError: com.google.api.client.json.JsonFactory.fromInputStream(Ljava/io/InputStream;Ljava/lang/Class;)

Where can I find the jar which contains this class and method?

1 Answer 1

2

The Google Drive Java client library is based on the Google APIs Java client library. Make sure you download it as well. The zip contains the library and all its dependencies.

Also make sure that you don't have conflicting versions of the Google Apis Client library in your compile/classpath as this method is only available in later versions.

Sign up to request clarification or add additional context in comments.

7 Comments

I tried after downloading the zip and using all the libraries and its dependencies, but still got the same error. com.google.api.client.json.JsonFactory is available in google-http-client-1.8.3-beta.jar, but the error shows that it does not have fromInputStream method....Is there any other jar file which contains this package?
That could typically happen if you have a conflicting version of a one of the dependencies. For instance you could be using another version of google-http somewhere in your path... Also you could try to get our Java sample running all the instructions are here: developers.google.com/drive/examples/java
Because if your compiler does not detect that the .fromInputStream is missing this means that you are compiling with a different version that actually running your Java code with. Are you using other Google APIs in your code? they might be using older google-http-client with deprecated methods.
Thanks for the help..You were right, there was a conflicting version of one of the dependencies
Nivco, I tried that example and I was able to get access token and refresh token using the authorization code..however there is no example to get an accesss token using refresh token. i.e., when I dont have an authorization code..Can you provide me the sample program or any link where I can find this??
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.