This is a subtle bug that's not going to affect everyone. If a Maven project using 'selenium-java' (etc) has another dependency on OkHttp (explicit or transitive) and that dep is at v4.0.0 then Maven's rules are that it will construct classpaths using the latest of all the alternatives.
That means that selenium-java's Drivers are going to use v4 of OkHttp when they were compiled against v3.11.0 (and all manifests implicate that one). There's trickery to downgrade OkHttp in use which will probably work (I will report back), but versions of deps in OSS pieces should attempt to keep up with maintainers releases. So can we upgrade OkHttp's dependency?
Stack trace, for the benefit of others:
java.lang.NoSuchFieldError: Companion
at okhttp3.internal.Util.<clinit>(Util.kt:69)
at okhttp3.internal.connection.RealConnectionPool.<clinit>(RealConnectionPool.kt:261)
at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:37)
at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:39)
at org.openqa.selenium.remote.internal.OkHttpClient$Factory.<init>(OkHttpClient.java:116)
at org.openqa.selenium.remote.http.HttpClient$Factory.createDefault(HttpClient.java:66)
at org.openqa.selenium.remote.HttpCommandExecutor.<clinit>(HttpCommandExecutor.java:47)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
Yes yes, OkHttp3 is the strict name of the OSS piece, and it's at v4.0.0 :-O
Yup, the
I'm looking into this at the moment--it looks like in order to include OkHttp4, we'll have to add a Kotlin library as well. I'm working on getting it all wired up, and I'll keep this thread and my branch updated with progress.
Facing the same issue, here are details.
Request request = new Request.Builder()
.url(uri.toString())
.headers(headers)
.post(requestBody)
.build();
Exception in thread "main" java.lang.NoSuchFieldError: Companion
at okhttp3.internal.Util.
at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1236)
at okhttp3.HttpUrl$Companion.get(HttpUrl.kt:1630)
at okhttp3.Request$Builder.url(Request.kt:184)
I've been working on this one, but I'm stiuck on the Kotlin dependency issue. I'll try to hash it out in the IRC channel.
MM
Sent from my iPhone
On Jul 17, 2019, at 8:53 AM, Muhammad Attique notifications@github.com wrote:
Facing the same issue, here are details.
Request request = new Request.Builder()
.url(uri.toString())
.headers(headers)
.post(requestBody)
.build();Exception in thread "main" java.lang.NoSuchFieldError: Companion
at okhttp3.internal.Util.(Util.kt:69)
at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1236)
at okhttp3.HttpUrl$Companion.get(HttpUrl.kt:1630)
at okhttp3.Request$Builder.url(Request.kt:184)—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
Looking at https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/4.0.1 I can see transitive deps on ..
And they themselves on ...
That was the trick! PR incoming!
MM
On Fri, Jul 19, 2019 at 6:33 AM Paul Hammant notifications@github.com
wrote:
Looking at
https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/4.0.1 I
can see deps on ..com.squareup.okio » okio » 2.2.2
org.jetbrains.kotlin » kotlin-stdlib » 1.3.40 (but choose 1.3.41 instead)—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/SeleniumHQ/selenium/issues/7373?email_source=notifications&email_token=AAMJDIZ5JF7HVQKT5OK4KTDQAGRCHA5CNFSM4H66EOFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2LMBSQ#issuecomment-513196234,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMJDI2ARRYZ4NZZKDLMQL3QAGRCHANCNFSM4H66EOFA
.
Good job :)
Most helpful comment
I'm looking into this at the moment--it looks like in order to include OkHttp4, we'll have to add a Kotlin library as well. I'm working on getting it all wired up, and I'll keep this thread and my branch updated with progress.