Matthias created FLINK-22630: -------------------------------- Summary: 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
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:okhttp}} internally and that using a different version of {{okhttp}} explains the error. 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)