Uploaded image for project: 'Nuxeo Java Client'
  1. Nuxeo Java Client
  2. JAVACLIENT-230

Make Java Client work with both okhttp 3.x and 4.x

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.13.0
    • Component/s: API

      Description

      While trying to upgrade okhttp library version to version 4.x from to 3.x.x (NXP-31266) of the platform, we figure out it was breaking some functional tests:

      Run "dev" functional tests / org.nuxeo.ftest.server.ITOAuth2Test – org.nuxeo.ftest.server.ITOAuth2Test(nuxeo-server-tests)
      <1s
      Error
      okhttp3/internal/Version
      Stacktrace
      java.lang.NoClassDefFoundError: okhttp3/internal/Version
      	at org.nuxeo.client.NuxeoClient.computeUserAgent(NuxeoClient.java:119)
      	at org.nuxeo.client.NuxeoClient.<init>(NuxeoClient.java:98)
      	at org.nuxeo.functionaltests.RestHelper$NuxeoClientForNuxeo.<init>(RestHelper.java:643)
      	at org.nuxeo.functionaltests.RestHelper$NuxeoClientForNuxeo$BuilderForNuxeo.connect(RestHelper.java:673)
      	at org.nuxeo.functionaltests.RestHelper.<clinit>(RestHelper.java:71)
      	at org.nuxeo.ftest.server.ITOAuth2Test.beforeClass(ITOAuth2Test.java:101)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
      	at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.junit.runners.Suite.runChild(Suite.java:128)
      	at org.junit.runners.Suite.runChild(Suite.java:27)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
      	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
      	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
      	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
      	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
      	at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
      	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
      	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
      Caused by: java.lang.ClassNotFoundException: okhttp3.internal.Version
      	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
      	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      	... 37 more
      

      see https://jira.nuxeo.com/browse/NXP-31266?focusedCommentId=654590&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-654590

      We need to adapt NuxeoClient.computeUserAgent to do not rely on okhttp3/internal/Version

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: