googleads / googleads-java-lib

Google Ad Manager SOAP API Client Library for Java
Apache License 2.0
226 stars 361 forks source link

NoClassDefFoundError: org/apache/commons/lang/exception/NestableException #128

Closed Padmahas closed 6 years ago

Padmahas commented 6 years ago

Hello,

Yesterday I downloaded googleads-java-lib-v3.9.0 maven code sample archive, imported to STS (Eclipse based IDE) and configured JSON path, Network code and Application name. Now any example I try to run I'm getting "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableException". I searched in pom.xml for apache.commons but there is no such dependencies mentioned. How to fix this issue.

Thank you.

jradcliff commented 6 years ago

Hi,

The dependency on commons-lang:commons-lang:2.6 is defined in modules/ads_lib/pom.xml. For some reason, that artifact doesn't include the word 'apache' in it, perhaps for the sake of brevity.

In your Eclipse setup, are you using maven or adding dependencies manually? If you're adding dependencies manually, then I recommend downloading the dfp-axis-jars-and-examples tarball from the Releases page. That tarball contains a lib directory with JARs for each dependency.

Thanks, Josh, AdWords API Team

Padmahas commented 6 years ago

Hello,

I think there is some misunderstanding. The pom.xml which is present in the downloaded example doesn't contain such a large list of dependencies. I downloaded example code from here, with the name dfp-axis-maven-and-examples. Are you mentioning the same?

Thank you.

jradcliff commented 6 years ago

Hi,

The pom in the tarball you mentioned has a dependency on com.google.api-ads:ads-lib:3.9.0, which in turn declares a dependency on the commons-lang dependency I mentioned. Therefore, maven should add commons-lang to your classpath.

Does Eclipse STS propagate dependencies to projects as described in the Maven docs, or does it only include direct dependencies for your project?

Thanks, Josh, AdWords API Team

jradcliff commented 6 years ago

Hi,

Just checking in -- were you able to resolve this issue?

Thanks, Josh, AdWords API Team

Padmahas commented 6 years ago

Hey Josh, Sorry I've not made any progress yet and I didn't get your question about propagating dependencies in STS. I don't know what's the behavior of Maven. I'm using Maven installed inside STS by default. Please let me know how can I find that behavior or any other way of resolving this issue. One more thing if this helps, I'm on Ubuntu 16.04, 64 bit OS.

Thank you.

jradcliff commented 6 years ago

Hi,

Provided the dependencies in a project's pom.xml file either have a dependency scope of compile or runtime (as is the case with the examples projects for this library), Maven should automatically add the following dependencies to the classpath:

One suggestion for determining if the problem you're experiencing is due to STS is to try running an example from the command line as mentioned in the README here. For example, for DFP you could run the following command from the project's directory (where its pom.xml file resides):

 mvn -X exec:java -Dexec.mainClass="dfp.axis.v201708.companyservice.GetAllCompanies"

If that works (the output ends with BUILD SUCCESS), then the issue lies with STS.

Thanks, Josh, AdWords API Team

jradcliff commented 6 years ago

Hi,

I'm closing this since I haven't seen any further comments in the last month. If you're still encountering problems, feel free to reopen with the latest details.

Cheers, Josh, AdWords API Team

vineet3101 commented 5 years ago

i am trying to connect couchDB, and getting below error::

Aug 05, 2019 8:33:36 PM com.fourspaces.couchdb.Session createDatabase WARNING: Error creating database: foodb Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) 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) at com.fourspaces.couchdb.Session.getDatabase(Session.java:203) at com.couchdb.demo.CouchDBCompleteDemo.createDatabase(CouchDBCompleteDemo.java:81) at com.couchdb.demo.CouchDBCompleteDemo.main(CouchDBCompleteDemo.java:45) Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException 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) ... 15 more