question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoClassDefFoundError: com/google/api/gax/retrying/RetrySettings at LanguageServiceSettings

See original GitHub issue

Hi I’ve created a java class with a main method in order to test NLP API.

Extract of my pom.xml:

	<!-- Google Cloud Natural Language API -->
	<dependency>
		<groupId>com.google.cloud</groupId>
		<artifactId>google-cloud-language</artifactId>
		<version>0.19.0-beta</version>
	</dependency>

In my GoogleTest java class I test others google APIs.

My method:

public static void myNaturalLanguageTest() throws IOException {
	
	//Instanciate a client
	LanguageServiceClient language = LanguageServiceClient.create();

	//Text to analyze
	String text = "Hello world";
	Document doc = Document.newBuilder().setContent(text).setType(Type.PLAIN_TEXT).build();

	//Detect the sentiment
	//TODO we obtained an error for the moment - 29-03-2017
	//java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
	Sentiment sentiment = language.analyzeSentiment(doc).getDocumentSentiment();

	System.out.printf("Text: %s%n", text);
	System.out.printf("Sentiment: %s, %s%n", sentiment.getScore(), sentiment.getMagnitude());
}

When I execute my java class, I obtain a NoCLassDefFoundError:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/api/gax/retrying/RetrySettings
	at com.google.cloud.language.spi.v1.LanguageServiceSettings$Builder.<clinit>(LanguageServiceSettings.java:245)
	at com.google.cloud.language.spi.v1.LanguageServiceSettings.defaultBuilder(LanguageServiceSettings.java:189)
	at com.google.cloud.language.spi.v1.LanguageServiceClient.create(LanguageServiceClient.java:114)
	at com.xxx.product.xxx.google.test.GoogleTest.myNaturalLanguageTest(GoogleTest.java:396)
	at com.xxx.product.moderation.google.test.GoogleTest.main(GoogleTest.java:259)
Caused by: java.lang.ClassNotFoundException: com.google.api.gax.retrying.RetrySettings
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 5 more

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pupimvictorcommented, Jun 27, 2017

Have you figured out the right setup for netty? I’m having the same issue here trying to use Pubsub

1reaction
garrettjonesgooglecommented, Jun 13, 2017

Now I think you are seeing the issue noted in https://github.com/GoogleCloudPlatform/google-cloud-java/issues/2050 . Add an explicit declaration of the versions of google-auth-library-credentials and google-auth-library-oauth2-http (they need to be at least 0.6.0 to avoid the ServiceAccountSigner problem).

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found