gpt4 book ai didi

java - ClassNotFoundException : io. opencensus.trace.propagation.TextFormat 未找到

转载 作者:太空宇宙 更新时间:2023-11-04 09:32:14 24 4
gpt4 key购买 nike

我在 apache karaf 4.2.6 和 java 11 中有一个模块,可以验证 Google Play 中的购买收据。我正在使用 androidpublisher。

当它第一次发送请求时,我在 OpenCensusUtils 类中收到错误:

androidPublisher.purchases().products().get(packageName, productId, purchaseToken).execute()

java.lang.ClassNotFoundException:wrap_file__Users_USER_NAME_.m2_repository_io_opencensus_opencensus-contrib-http-util_0.22.1_opencensus-contrib-http-util-0.22.1.jar找不到io.opencensus.trace.propagation.TextFormat

在随后的时间里,我在 com.google.api.client.http.HttpRequest 类中遇到错误 private Final Tracer tracer = OpenCensusUtils.getTracer():

java.lang.NoClassDefFoundError:无法初始化类 com.google.api.client.http.OpenCensusUtils

这是依赖项:

    <dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-androidpublisher</artifactId>
<version>v3-rev92-1.25.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.29.2</version>
</dependency>

<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-api</artifactId>
<version>0.22.1</version>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-contrib-http-util</artifactId>
<version>0.22.1</version>
</dependency>

此外,google-api-clientgoogle-http-client-jackson2google-oauth-client 的版本为 1.29.2

在 karaf 中,我看到库 opencensus-api 正在导出包含类 TextFormat 的包 io.opencensus.trace.propagation

我做错了什么?

最佳答案

我通过将 io.opencensus 和 io.grpc 添加到模块构建区域的 Private-Package 来解决,如下所示。它使它们嵌入本地。

....
<build>
<plugins>
<plugin>
....
<configuration>
<instructions>
<Bundle-SymbolicName> ${project.artifactId} </Bundle-SymbolicName>
<Private-Package>
META-INF.services;-split-package:=merge-first,
com.google.*;-split-package:=merge-first,
io.opencensus.*;-split-package:=merge-first,
io.grpc.*;-split-package:=merge-first
</Private-Package>
....

关于java - ClassNotFoundException : io. opencensus.trace.propagation.TextFormat 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56950415/

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