Exception in thread "main" java.lang.NoClassDefFoundError: com/google/api/ads/common/lib/client/AdsSession

329 views
Skip to first unread message

Z He

unread,
Jun 10, 2014, 6:17:09 PM6/10/14
to google-doubleclick-...@googlegroups.com
Hi, support team,
I am using DFA API 1.20, and download the dfa lib dfa-axis-jars-and-examples:
I test my script in eclipse, all works OK. 
Then I started to run the java script in command line in Ubuntu 12.04. But keep getting exception as below:
---------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/api/ads/common/lib/client/AdsSession
Caused by: java.lang.ClassNotFoundException: com.google.api.ads.common.lib.client.AdsSession
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
-----------------------------

As I do not use class AdsSession, I do not know why I got this error. Any clue about it?
I list all the lib that I used below in case it can help.
-------------------------
import com.google.api.ads.common.lib.auth.OfflineCredentials;
import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
import com.google.api.ads.common.lib.exception.OAuthException;
import com.google.api.ads.common.lib.exception.ValidationException;
import com.google.api.ads.dfa.axis.factory.DfaServices;
import com.google.api.ads.dfa.axis.v1_20.Advertiser;
import com.google.api.ads.dfa.axis.v1_20.AdvertiserRecordSet;
import com.google.api.ads.dfa.axis.v1_20.AdvertiserRemote;
import com.google.api.ads.dfa.axis.v1_20.AdvertiserSearchCriteria;
import com.google.api.ads.dfa.axis.v1_20.Subnetwork;
import com.google.api.ads.dfa.axis.v1_20.SubnetworkRecordSet;
import com.google.api.ads.dfa.axis.v1_20.SubnetworkRemote;
import com.google.api.ads.dfa.axis.v1_20.SubnetworkSearchCriteria;
import com.google.api.ads.dfa.lib.client.DfaSession;
import com.google.api.ads.dfa.lib.client.DfaSession.Environment;
import com.google.api.client.auth.oauth2.Credential;
-----------------------------

Jonathon Imperiosi (DFA API Team)

unread,
Jun 11, 2014, 9:14:43 AM6/11/14
to google-doubleclick-...@googlegroups.com
Hello,

AdsSession is the interface implemented by all the product specific session classes (ie, DfaSession). This interface is part of the ads common library (ads-lib-1.28.0.jar, in the distro you've linked). From that stacktrace, it looks like the common library is not being included on the classpath. Note that this is handled by the included .classpath file in Eclipse, but may need to be configured manually if you intend to run the examples outside of Eclipse.

Regards,
- Jonathon Imperiosi, DFA API Team
Reply all
Reply to author
Forward
0 new messages