I try to run this code on appEngine (with java8 defined in my web.xml)
public TopicName createTopic(final String topicNameStr) throws Exception {
checkInit();
final TopicAdminSettings topicAdminSettings =
TopicAdminSettings.defaultBuilder()
.setChannelProvider(channelProvider)
.build();
TopicName topicName = TopicName.create(projectId, topicNameStr);
try (final TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings)) {
topicAdminClient.createTopic(topicName);
}
return topicName;
}
and i get this error:
Uncaught exception from servlet
java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:284)
at com.google.api.gax.grpc.InstantiatingChannelProvider.createChannel(InstantiatingChannelProvider.java:135)
at com.google.api.gax.grpc.InstantiatingChannelProvider.getChannel(InstantiatingChannelProvider.java:116)
at com.google.api.gax.grpc.ChannelAndExecutor.create(ChannelAndExecutor.java:65)
at com.google.api.gax.grpc.ClientSettings.getChannelAndExecutor(ClientSettings.java:77)
at com.google.cloud.pubsub.spi.v1.TopicAdminClient.<init>(TopicAdminClient.java:150)
at com.google.cloud.pubsub.spi.v1.TopicAdminClient.create(TopicAdminClient.java:141)
at linqmap.cloud.google.pubsub.PubSubFactory.createTopic(PubSubFactory.java:142)
how can i fix this?
Try using guava 18.0 or later this will resolve the issue.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With