Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when I use version 6.0.0, I am getting this exceptions, kotlin/jvm/internal/Intrinsics #342

Closed
cuixin3266 opened this issue Apr 21, 2022 · 15 comments
Labels
wontfix This will not be worked on
Milestone

Comments

@cuixin3266
Copy link

`
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
@cuixin3266 cuixin3266 changed the title when I use version 6.0.0, I find this exception, kotlin/jvm/internal/Intrinsics when I use version 6.0.0, I am getting this exceptions, kotlin/jvm/internal/Intrinsics Apr 21, 2022
@bednar
Copy link
Contributor

bednar commented Apr 22, 2022

Hi @cuixin3266,

thanks for using our client.

The version 6.0.0 has updated dependencies.

How looks your project? Can you share your dependency tree? Do you use Maven or Gradle?

Regards

@bednar bednar added the question Further information is requested label Apr 22, 2022
@bednar
Copy link
Contributor

bednar commented Apr 22, 2022

Which version Kotlin do you use?

@cuixin3266
Copy link
Author

Which version Kotlin do you use?

Kotlin version is IDEA built-in 1.5, the project uses Maven development, version 3.8.2
QQ截图20220422125550

@bednar
Copy link
Contributor

bednar commented Apr 22, 2022

Can you share whole dependency tree? You can use: mvn dependency:tree

@cuixin3266
Copy link
Author

sorry
QQ截图20220422131646

@cuixin3266
Copy link
Author

I don't seem to see the influxdb dependency, what's wrong with this?

@bednar
Copy link
Contributor

bednar commented Apr 22, 2022

You probably ran the command in the wrong directory.

Anyway... Can you test explicitly exclude gson from client dependency and add gson as a new dependency:

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.9.0</version>
</dependency>
<dependency>
    <groupId>com.influxdb</groupId>
    <artifactId>influxdb-client-java</artifactId>
    <version>6.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </exclusion>
    </exclusions>
</dependency>

?

@cuixin3266
Copy link
Author

i try to do this, it's seem like doesn't work, and the dependency tree seem like normal
9SD_8ZIK2~T1BR3RO2 }D
EAP61AG96976XR{Q)0MU9CB

@bednar
Copy link
Contributor

bednar commented Apr 22, 2022

Well, I don't know why every execution seems to have a different result, when i use: mvn dependency:tree

This is very strange.

You can try find dependency version collision by: mvn dependency:tree -U -Dverbose=true

@cuixin3266
Copy link
Author

I tried to delete other dependencies until I tested the springboot dependencies, I found that once I added this parent dependency, my project would report an error

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

I tried to use different springboot version dependencies, and the results are all errors. When using 2.1.3.RELEASE, the following errors appear

Exception in thread "main" java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto([B[BIII)[B
	at okio.Segment.writeTo(Segment.kt:169)
	at okio.Segment.compact(Segment.kt:152)
	at okio.Buffer.write(Buffer.kt:1461)
	at okio.Buffer.read(Buffer.kt:1473)
	at okio.Buffer.writeAll(Buffer.kt:1260)
	at okio.Options$Companion.buildTrieRecursive(Options.kt:189)
	at okio.Options$Companion.buildTrieRecursive(Options.kt:175)
	at okio.Options$Companion.buildTrieRecursive$default(Options.kt:113)
	at okio.Options$Companion.of(Options.kt:72)
	at okhttp3.internal.Util.<clinit>(Util.kt:70)
	at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1239)
	at okhttp3.HttpUrl$Companion.get(HttpUrl.kt:1633)
	at okhttp3.HttpUrl$Companion.parse(HttpUrl.kt:1642)
	at okhttp3.HttpUrl.parse(HttpUrl.kt)
	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.example.demo.SynchronousQuery.query(SynchronousQuery.java:81)
	at com.example.demo.SynchronousQuery.main(SynchronousQuery.java:19)

When using 2.4.0 or 2.6.7, the following errors appear

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.example.demo.SynchronousQuery.query(SynchronousQuery.java:81)
	at com.example.demo.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)
	... 14 more

when i remove the springboot parent dependency, i have right result

@xx13295
Copy link

xx13295 commented Apr 24, 2022

` 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
你可以试试这样。

@cuixin3266
Copy link
Author

谢谢,问题解决了

@bednar bednar added this to the 6.1.0 milestone Apr 25, 2022
@bednar bednar added wontfix This will not be worked on and removed question Further information is requested labels Apr 25, 2022
@linghengqian
Copy link

linghengqian commented Apr 27, 2022

I have to say that influxdb-client-java is the first dependency I have seen using okhttp 4.9.3😆, I think this is enough to make a mark for spring-boot-starter-parent<2.7.0-M2 in README.md (after all, not who You can think of okhttp when you see an error from Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics at okio.Buffer.write(Buffer.kt), refer to the discussion at spring-projects/spring-boot#18506 (comment) )

@cuixin3266
Copy link
Author

I have to say that influxdb-client-java is the first version I have seen using okhttp 4.9.3😆, I think this is enough to make a mark for spring-boot-starter-parent<2.7.0-M2 in README.md (after all, not who You can think of okhttp when you see an error from Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics at okio.Buffer.write(Buffer.kt), refer to the discussion at spring-projects/spring-boot#18506 (comment) )

Your idea is great, if it wasn't for the help of the community, I might still be stuck with this problem, for the less experienced, this will save the mind

@bednar
Copy link
Contributor

bednar commented Apr 28, 2022

@linghengqian, @cuixin3266, @xx13295

I am very grateful for your advice and comments. I've prepared the following update of documentation: #345.

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants