question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.ClassCastException: okio.ByteString cannot be cast to java.lang.Comparable

See original GitHub issue

When deploying to an Apache Flink 1.6 cluster on AWS EMR 5.18.0, okhttp throws an error with okio. Locally, everything runs smoothly (as they always say…).

Caused by: java.lang.ExceptionInInitializerError
	at okhttp3.HttpUrl$Builder.parse(HttpUrl.java:1313)
	at okhttp3.HttpUrl.get(HttpUrl.java:917)
	at okhttp3.Request$Builder.url(Request.java:165)
	... 9 more
Caused by: java.lang.ClassCastException: okio.ByteString cannot be cast to java.lang.Comparable
	at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:320)
	at java.util.ComparableTimSort.sort(ComparableTimSort.java:188)
	at java.util.Arrays.sort(Arrays.java:1312)
	at java.util.Arrays.sort(Arrays.java:1506)
	at java.util.ArrayList.sort(ArrayList.java:1462)
	at java.util.Collections.sort(Collections.java:141)
	at kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sort(MutableCollectionsJVM.kt:27)
	at okio.Options$Companion.of(Options.kt:43)
	at okio.Options.of(Options.kt)
	at okhttp3.internal.Util.<clinit>(Util.java:73)

Dependency setup:

        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>3.13.1</version>
        </dependency>

        <!-- Dependency of okhttp -->
        <dependency>
            <groupId>com.squareup.okio</groupId>
            <artifactId>okio</artifactId>
            <version>2.2.2</version>
        </dependency>

JVM:

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

EMR configured apps:

  • Hadoop 2.8.4
  • Flink 1.6.0
  • Hue 4.2.0

I have seen other posts about conflicts with Apache Spark, but have not seen this error nor mentions of conflicts with Flink. If this is just a simple version conflict, how might I go about fixing it?

Thank you!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
austincecommented, Feb 28, 2019

For anyone else who might find their way to this thread, here is a convo with the mailing list about how to solve this issue. And here is the debugging classloading guide.

0reactions
austincecommented, Feb 27, 2019

Ok, thank you for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot be cast to java.lang.Comparable while sorting ...
Problem statement: I am trying to sort a composite class using comparable and collections.sort but getting exception.
Read more >
okhttp3 maven
java lang classcastexception okio bytestring cannot be cast to java lang comparable. The TreeSet orders it's elements. To do that it either needs...
Read more >
Solved Error: cannot be cast to java.lang.Comparable
Here various reasons and ways to solve the exception cannot be cast to java.lang.Comparable. Let us first have a brief look at what...
Read more >
ByteString (Okio 1.17.4 API) - javadoc.io
Returns a ByteBuffer view of the bytes in this ByteString . java.lang.String, base64(). Returns this byte string encoded as Base64.
Read more >
Cannot be cast to java.lang.Comparable - Codersdesks.com
Cannot be cast to java.lang.Comparable · Problem: java.lang. · Reason: When we sort array or collection of primitive or wrapper classes it works ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found