0

上のpubsubを初期化するとき、私は(私のweb.xmlで定義されjava8で)AppEngineの上でこのコードを実行しようとjava.lang.NoClassDefFoundErrorが:COM /グーグル/共通/ベース/ MoreObjects AppEngineの

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; 
} 

と私このエラーが表示される:

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) 

これはどのように修正できますか?

+0

guava '18.0以降':jarを使用してください。 – soorapadman

+0

ありがとう!出来た –

答えて

2

guava 18.0以降を使用すると、問題が解決されます。

<dependency> 
    <groupId>com.google.guava</groupId> 
    <artifactId>guava</artifactId> 
    <version>18.0</version> 
</dependency> 
関連する問題