简体   繁体   English

java.lang.NoSuchFieldError: Companion when using `influx-client-reactive` 和 `quarkus`

[英]java.lang.NoSuchFieldError: Companion when using `influx-client-reactive` and `quarkus`

Error occurs when instantiating a client实例化客户端时发生错误

    InfluxDBClientReactive influxDBClient = InfluxDBClientReactiveFactory.create(
            influxConf.url(),
            influxConf.username(),
            influxConf.password().toCharArray());

dependency is excluded from quarkus-bom依赖被排除在quarkus-bom之外

implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") {
    exclude group: "com.squareup.okhttp3", module: "okhttp"
}
implementation "com.influxdb:influxdb-client-reactive:6.4.0" 

otherwise (3.xx) is forced and would cause否则 (3.xx) 是强制的并且会导致

'okhttp3.RequestBody okhttp3.RequestBody.create(java.lang.String, okhttp3.MediaType)'
java.lang.NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(java.lang.String, okhttp3.MediaType)

at the same line.在同一行。

trace:痕迹:

Companion
java.lang.NoSuchFieldError: Companion
    at okhttp3.internal.Util.<clinit>(Util.kt:70)
    at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1239)
    at okhttp3.HttpUrl$Companion.get(HttpUrl.kt:1634)
    at okhttp3.HttpUrl$Companion.parse(HttpUrl.kt:1643)
    at okhttp3.HttpUrl.parse(HttpUrl.kt)
    at com.influxdb.client.InfluxDBClientOptions$Builder$ParsedUrl.<init>(InfluxDBClientOptions.java:689)
    at com.influxdb.client.InfluxDBClientOptions$Builder$ParsedUrl.<init>(InfluxDBClientOptions.java:681)
    at com.influxdb.client.InfluxDBClientOptions$Builder.connectionString(InfluxDBClientOptions.java:504)
    at com.influxdb.client.InfluxDBClientOptions$Builder.url(InfluxDBClientOptions.java:288)
    at com.influxdb.client.reactive.InfluxDBClientReactiveFactory.create(InfluxDBClientReactiveFactory.java:105)

This issue led me to think that com.squareup.okio:okio might also play a role here. 这个问题让我认为com.squareup.okio:okio也可能在这里发挥作用。

com.squareup.okio:okio:1.17.2
\--- io.quarkus:quarkus-bom:2.11.2.Final
     \--- runtimeClasspath

com.squareup.okio:okio:3.0.0 -> 1.17.2
\--- com.squareup.okhttp3:okhttp:4.10.0

That Options.of is a call to method in that dependency and not Optional from java.Options.of是对该依赖项中的方法的调用,而不是 java 中的Optional方法。 That there is nothing strange here other than some quarkus necromancy forced for fabric8io/kubernetes-client除了为fabric8io/kubernetes-client强制执行的一些quarkus 死灵法外,这里没有什么奇怪的

exclude group: "com.squareup.okio", module: "okio"

from quarkus-bom来自quarkus-bom

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM