gpt4 book ai didi

java - 错误/java.lang.NoClassDefFoundError : com/google/api/services/pubsub/PubsubScopes

转载 作者:行者123 更新时间:2023-12-02 12:54:53 36 4
gpt4 key购买 nike

我正在尝试将我的 PubSub-Maven 项目部署到 Appengine。部署成功,但登录后出现错误:

Error for /
java.lang.NoClassDefFoundError: com/google/api/services/pubsub/PubsubScopes

at com.wi.pubsubtest.util.PubsubUtils.getClient(PubsubUtils.java:80)
at de.com.wi.pubsubtest.util.PubsubUtils.getClient(PubsubUtils.java:60)
.....

对于包装,我使用这个 pom:

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<failOnMissingWebXml>false</failOnMissingWebXml>
<appengine.maven.plugin>1.3.1</appengine.maven.plugin>
<jetty.maven.plugin>9.4.3.v20170317</jetty.maven.plugin>
</properties>



<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>1.2.0</version>
</dependency>

<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-credentials</artifactId>
<version>0.6.1</version>
</dependency>
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
<version>0.6.1</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>



<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-pubsub</artifactId>
<version>0.17.2-alpha</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore</artifactId>
<version>1.0.1</version>
</dependency>

<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.21.0</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-appengine</artifactId>
<version>1.21.0</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-servlet</artifactId>
<version>1.21.0</version>
</dependency>


</dependencies>

<build>


<plugins>

<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.maven.plugin}</version>
</plugin>

<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin}</version>
<configuration>
<deploy.stopPreviousVersion>true</deploy.stopPreviousVersion> </configuration>
</plugin>

</plugins>

</build>

最佳答案

com.google.api.services.pubsub 包通过 google-api-services-pubsub dependency 导出。所以你必须将它添加到你的项目中。

<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-pubsub</artifactId>
<version>v1-rev356-1.22.0</version>
</dependency>

关于java - 错误/java.lang.NoClassDefFoundError : com/google/api/services/pubsub/PubsubScopes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44474055/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com