debbiereid / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Google drive Code is compiled but not running #900

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-api-java-client (e.g. 1.15.0-rc)?
1.19.0

Java environment (e.g. Java 6, Android 2.3, App Engine)?
java version "1.7.0_51"

Describe the problem.
I am new to google API. I have written a code to upload a file on google drive 
using service account. I have generated the API-KEY for my account.
I have added all jars to classpath. I am able to compile the code without any 
error. But upon running the code, I get no class def found error.

Exception in thread "main" java.lang.NoClassDefFoundError: 
com/google/appengine/api/appidentity/AppIdentityServiceFactory
        at com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential.<init>(AppIdentityCredential.java:86)
        at com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential$Builder.build(AppIdentityCredential.java:178)
        at DriveCommandLine.main(DriveCommandLine.java:37)
Caused by: java.lang.ClassNotFoundException: 
com.google.appengine.api.appidentity.AppIdentityServiceFactory
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 3 more

Please help. I have attached my code into this case. I have removed the API-KEY 
string.

How would you expect it to be fixed?
Either some jar file is missing or some other issue is there. If code is 
compiling properly then it should also run without any class error.

Original issue reported on code.google.com by adityaz...@gmail.com on 31 Aug 2014 at 4:27

Attachments:

GoogleCodeExporter commented 9 years ago
Also attaching all jars that I am using.

Original comment by adityaz...@gmail.com on 31 Aug 2014 at 4:30

Attachments:

GoogleCodeExporter commented 9 years ago
"If code is compiling properly then it should also run without any class 
error." This is not necessarily true.

Your compile-time classpath might differ from your run-time classpath. Did you 
just want to use service account, or you actually wanted to run your app on 
AppEngine (I am guessing because you used 
com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCre
dential)?

Original comment by wonder...@google.com on 29 Dec 2014 at 8:23