[ 
https://issues.apache.org/jira/browse/FLINK-22630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17342420#comment-17342420
 ] 

Matthias commented on FLINK-22630:
----------------------------------

[~chesnay] My first proposal would have been to add 
{{com.squareup.okhttp3:okhttp}} and {{com.squareup.okhttp3:mockwebserver}} to 
the Flink project's overall dependency management. But the mockwebserver is 
really only used in {{flink-kubernetes}}. Instead, we could add 
{{com.squareup.okhttp3:okhttp}} to the dependency management to make all 
modules use the same version and expose the version as a property which can be 
used by {{flink-kubernetes}} to explicitly define the dependency version for 
{{com.squareup.okhttp3:mockwebserver}}. WDYT?

> Different com.squareup.okhttp3:okhttp dependency versions might lead to 
> version conflicts with io.fabric8:kubernetes-server-mock
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-22630
>                 URL: https://issues.apache.org/jira/browse/FLINK-22630
>             Project: Flink
>          Issue Type: Improvement
>          Components: Build System
>    Affects Versions: 1.14.0
>            Reporter: Matthias
>            Priority: Minor
>
> I ran into the following issue when executing {{Fabric8FlinkKubeClientTest}} 
> in a test suite from a different flink module that has 
> {{com.squareup.okhttp3:okhttp}} set as a dependency (more specifically in my 
> case {{flink-runtime}}'s {{ZooKeeperStateHandleStoreTest}}) from within 
> Intellij:
> {code}
> Exception in thread "MockWebServer" java.lang.NoSuchFieldError: 
> H2_PRIOR_KNOWLEDGE
>       at 
> okhttp3.mockwebserver.MockWebServer$3.processConnection(MockWebServer.java:499)
>       at okhttp3.mockwebserver.MockWebServer$3.execute(MockWebServer.java:443)
>       at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>       at java.lang.Thread.run(Thread.java:748)
> {code}
> Interestingly, the test didn't fail when executing it from command line:
> {code}
> mvn -pl flink-runtime,flink-kubernetes test 
> -Dtest=Fabric8FlinkKubeClientTest,ZooKeeperStateHandleStoreTest -Dfast
> {code}
> {{Fabric8FlinkKubeClientTest}} also doesn't fail if running multiple tests of 
> {{flink-kubernetes}}.
> The issue is caused by the {{MockWebServer}} implementation. I found a hint 
> on [StackOverflow|https://stackoverflow.com/a/64437318/11118339] indicating 
> that {{io.fabric8:kubernetes-server-mock}} uses 
> {{com.squareup.okhttp3:mockwebserver}} internally which leads to the version 
> clash and the error shown above.
> I checked the other dependencies and realized that we use 
> {{com.squareup.okhttp3:okhttp}} in multiple modules and that Intellij adds 
> all of these dependencies versions to the classpath. My conclusion was that 
> there might be a version conflict accessing the wrong dependency version when 
> loading the dependencies for the test execution that results in the error 
> shown above.
> I verified my finding by updating the version for all 
> {{{{com.squareup.okhttp3:okhttp}} dependencies to {{1.12.6}} which is used in 
> {{flink-kubernetes}} and reloaded the Maven dependencies within Intellij. 
> This made the above mentioned test suite containing 
> {{Fabric8FlinkKubeClientTest}} in a test suite from a different flink module 
> that has {{com.squareup.okhttp3:okhttp}} and 
> {{ZooKeeperStateHandleStoreTest}} succeed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to