我在 apache karaf 4.2.6 中有一个带有 java 11 的模块,用于验证 Google Play 中的购买收据。我正在使用androidpublisher。
当它第一次发送请求时,我在 OpenCensusUtils 类中收到错误:
androidPublisher.purchases().products().get(packageName, productId, purchaseToken).execute()
java.lang.ClassNotFoundException: io.opencensus.trace.propagation.TextFormat not found by wrap_file__Users_USER_NAME_.m2_repository_io_opencensus_opencensus-contrib-http-util_0.22.1_opencensus-contrib-http-util-0.22.1.jar
在随后的时间里,我在 com.google.api.client.http.HttpRequest 类中出现错误private final Tracer tracer = OpenCensusUtils.getTracer()
:
java.lang.NoClassDefFoundError: Could not initialize class 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-client
,google-http-client-jackson2
并且google-oauth-client
有版本 1.29.2
在 karaf 我看到库opencensus-api
正在导出一个 io.opencensus.trace.propagation
包含类 TextFormat 的包。
我究竟做错了什么?