Closed
Description
In which file did you encounter the issue?
java-docs-samples/language/cloud-client/src/main/java/com/example/language/QuickstartSample.java
Did you change the file? If so, how?
no
Describe the issue
I added the lib import in my pom.xml:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-language</artifactId>
<version>0.9.4-alpha</version>
</dependency>
Then I follow the quick start:
//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
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 the code, I obtain an error:
log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
mars 29, 2017 12:26:59 PM io.grpc.internal.ManagedChannelImpl <init>
INFOS: [ManagedChannelImpl@8e4bb0] Created with target language.googleapis.com:443
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
at io.grpc.internal.ClientCallImpl.<init>(ClientCallImpl.java:103)
at io.grpc.internal.ManagedChannelImpl$RealChannel.newCall(ManagedChannelImpl.java:556)
at io.grpc.auth.ClientAuthInterceptor.interceptCall(ClientAuthInterceptor.java:82)
at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:120)
at com.google.api.gax.grpc.HeaderInterceptor.interceptCall(HeaderInterceptor.java:57)
at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:120)
at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:535)
at com.google.api.gax.grpc.DescriptorClientCallFactory.newCall(DescriptorClientCallFactory.java:54)
at com.google.api.gax.grpc.DirectCallable.futureCall(DirectCallable.java:60)
at com.google.api.gax.grpc.ExceptionTransformingCallable.futureCall(ExceptionTransformingCallable.java:62)
at com.google.api.gax.grpc.RetryingCallable$RetryingResultFuture.issueCall(RetryingCallable.java:216)
at com.google.api.gax.grpc.RetryingCallable.futureCall(RetryingCallable.java:84)
at com.google.api.gax.grpc.UnaryCallable.futureCall(UnaryCallable.java:243)
at com.google.api.gax.grpc.UnaryCallable.futureCall(UnaryCallable.java:254)
at com.google.api.gax.grpc.UnaryCallable.call(UnaryCallable.java:282)
at com.google.cloud.language.spi.v1.LanguageServiceClient.analyzeSentiment(LanguageServiceClient.java:213)
at com.google.cloud.language.spi.v1.LanguageServiceClient.analyzeSentiment(LanguageServiceClient.java:190)
at com.atchikrealtime.product.moderation.google.test.GoogleTest.myNaturalLanguageTest(GoogleTest.java:402)
at com.atchikrealtime.product.moderation.google.test.GoogleTest.main(GoogleTest.java:259)
Metadata
Metadata
Assignees
Labels
No labels