NoClassDefFoundError: com/google/api/gax/retrying/RetrySettings at LanguageServiceSettings
See original GitHub issueHi 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:
- Created 6 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Have you figured out the right setup for netty? I’m having the same issue here trying to use Pubsub
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).