influxdb-client-java: when I use version 6.0.0, I am getting this exceptions, kotlin/jvm/internal/Intrinsics

` import java.util.List;

import com.influxdb.client.InfluxDBClient; import com.influxdb.client.InfluxDBClientFactory; import com.influxdb.client.QueryApi; import com.influxdb.query.FluxRecord; import com.influxdb.query.FluxTable;

public class SynchronousQuery {

private static final char[] token = "VbP83ofbBPZJpC8FmHxpl68Ali9eEZQ8hMoVJIuZ2rp86YcIuInXfnrh67QIq9gN9gYLS4J0GEoaZFgSUv87MA==".toCharArray();
private static final String org = "xiaole";

public static void main(final String[] args) {

    InfluxDBClient influxDBClient = InfluxDBClientFactory.create("http://localhost:8086", token, org);

    String flux = "from(bucket:\"my-bucket\") |> range(start: 0)";

    QueryApi queryApi = influxDBClient.getQueryApi();

    //
    // Query data
    //
    List<FluxTable> tables = queryApi.query(flux);
    for (FluxTable fluxTable : tables) {
        List<FluxRecord> records = fluxTable.getRecords();
        for (FluxRecord fluxRecord : records) {
            System.out.println(fluxRecord.getTime() + ": " + fluxRecord.getValueByKey("_value"));
        }
    }

    influxDBClient.close();
}

}`

Steps to reproduce: List the minimal actions needed to reproduce the behavior.

  1. I found this exception when I tried to write, but it still exists when I use the read function from the official document

Exception in thread “main” java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics at okio.Buffer.write(Buffer.kt) at okhttp3.ResponseBody.create(ResponseBody.java:214) at okhttp3.internal.Util.<clinit>(Util.java:69) at okhttp3.HttpUrl$Builder.parse(HttpUrl.java:1313) at okhttp3.HttpUrl.get(HttpUrl.java:917) at okhttp3.HttpUrl.parse(HttpUrl.java:905) at com.influxdb.client.InfluxDBClientOptions$Builder$ParsedUrl.<init>(InfluxDBClientOptions.java:644) at com.influxdb.client.InfluxDBClientOptions$Builder$ParsedUrl.<init>(InfluxDBClientOptions.java:636) at com.influxdb.client.InfluxDBClientOptions$Builder.connectionString(InfluxDBClientOptions.java:471) at com.influxdb.client.InfluxDBClientOptions$Builder.url(InfluxDBClientOptions.java:274) at com.influxdb.client.InfluxDBClientFactory.create(InfluxDBClientFactory.java:174) at com.influxdb.client.InfluxDBClientFactory.create(InfluxDBClientFactory.java:149) at com.lanshancloud.service.SynchronousQuery.main(SynchronousQuery.java:19) Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) … 13 more

  1. Then when I try to reduce the version to 5.0.0, the exception does not exist and the program runs normally

Expected behavior: Show something, or perform it normally

Actual behavior: Exceptions were thrown

Specifications:

  • Client Version: com.influxdb influxdb-client-java 6.0.0
  • InfluxDB Version: 2.0.7
  • JDK Version: 1.8.0_281
  • Platform: docker
  • development environment: Windows10 & IntelliJ IDEA 2021.3

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

` import java.util.List;

import com.influxdb.client.InfluxDBClient; import com.influxdb.client.InfluxDBClientFactory; import com.influxdb.client.QueryApi; import com.influxdb.query.FluxRecord; import com.influxdb.query.FluxTable;

public class SynchronousQuery {

private static final char[] token = "VbP83ofbBPZJpC8FmHxpl68Ali9eEZQ8hMoVJIuZ2rp86YcIuInXfnrh67QIq9gN9gYLS4J0GEoaZFgSUv87MA==".toCharArray();
private static final String org = "xiaole";

public static void main(final String[] args) {

    InfluxDBClient influxDBClient = InfluxDBClientFactory.create("http://localhost:8086", token, org);

    String flux = "from(bucket:\"my-bucket\") |> range(start: 0)";

    QueryApi queryApi = influxDBClient.getQueryApi();

    //
    // Query data
    //
    List<FluxTable> tables = queryApi.query(flux);
    for (FluxTable fluxTable : tables) {
        List<FluxRecord> records = fluxTable.getRecords();
        for (FluxRecord fluxRecord : records) {
            System.out.println(fluxRecord.getTime() + ": " + fluxRecord.getValueByKey("_value"));
        }
    }

    influxDBClient.close();
}

}`

Steps to reproduce: List the minimal actions needed to reproduce the behavior.

  1. I found this exception when I tried to write, but it still exists when I use the read function from the official document

Exception in thread “main” java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics at okio.Buffer.write(Buffer.kt) at okhttp3.ResponseBody.create(ResponseBody.java:214) at okhttp3.internal.Util.(Util.java:69) at okhttp3.HttpUrl$Builder.parse(HttpUrl.java:1313) at okhttp3.HttpUrl.get(HttpUrl.java:917) at okhttp3.HttpUrl.parse(HttpUrl.java:905) at com.influxdb.client.InfluxDBClientOptions$Builder$ParsedUrl.(InfluxDBClientOptions.java:644) at com.influxdb.client.InfluxDBClientOptions$Builder$ParsedUrl.(InfluxDBClientOptions.java:636) at com.influxdb.client.InfluxDBClientOptions$Builder.connectionString(InfluxDBClientOptions.java:471) at com.influxdb.client.InfluxDBClientOptions$Builder.url(InfluxDBClientOptions.java:274) at com.influxdb.client.InfluxDBClientFactory.create(InfluxDBClientFactory.java:174) at com.influxdb.client.InfluxDBClientFactory.create(InfluxDBClientFactory.java:149) at com.lanshancloud.service.SynchronousQuery.main(SynchronousQuery.java:19) Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) … 13 more

  1. Then when I try to reduce the version to 5.0.0, the exception does not exist and the program runs normally

Expected behavior: Show something, or perform it normally

Actual behavior: Exceptions were thrown

Specifications:

  • Client Version: com.influxdb influxdb-client-java 6.0.0
  • InfluxDB Version: 2.0.7
  • JDK Version: 1.8.0_281
  • Platform: docker
  • development environment: Windows10 & IntelliJ IDEA 2021.3

image image image 你可以试试这样。

@linghengqian, @cuixin3266, @xx13295

I am very grateful for your advice and comments. I’ve prepared the following update of documentation: https://github.com/influxdata/influxdb-client-java/pull/345.

Thanks again