Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-25870

Upgrade Swagger to 1.6.2+ for avoiding NoSuchMethodError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.8.0
    • None
    • None

    Description

      Currently, running unit tests for ambari-utility fails with the following error.

      $ mvn clean test -f ambari-utility/pom.xml
      
      ...
      
      [ERROR] Tests run: 8, Failures: 0, Errors: 7, Skipped: 0, Time elapsed: 0.656 s <<< FAILURE! - in org.apache.ambari.swagger.AmbariSwaggerReaderTest
      
      ...
      
      [ERROR] Errors:
      [ERROR]   AmbariSwaggerReaderTest.swaggerApiThatIsBothTopLevelAndNestedIsCountedAsTopLevel:171 » NoSuchMethod
      [ERROR]   AmbariSwaggerReaderTest.swaggerBasicCase:71 » NoSuchMethod com.fasterxml.jacks...
      [ERROR]   AmbariSwaggerReaderTest.swaggerConflictingNestedApis:86 » NoSuchMethod com.fas...
      [ERROR]   AmbariSwaggerReaderTest.swaggerConflictingNestedApisWithBadPreferredParent:140 » NoSuchMethod
      [ERROR]   AmbariSwaggerReaderTest.swaggerConflictingNestedApisWithPreferredParent:103 » NoSuchMethod
      [ERROR]   AmbariSwaggerReaderTest.swaggerConflictingNestedApisWithSamePreferredParent:121 » NoSuchMethod
      [ERROR]   AmbariSwaggerReaderTest.swaggerNestedApisWithOverwrite:156 » NoSuchMethod com....
      [INFO]
      [ERROR] Tests run: 10, Failures: 0, Errors: 7, Skipped: 1
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      

      This is because the old version of Swagger uses Jackson's getType method internally, which is deprecated and removed in v2.9, while we are using Jackson v2.12.

      Upgrading Swagger to 1.6.2 or greater fixes this problem, just like the following case.
      https://github.com/swagger-api/swagger-core/issues/3554#issuecomment-652366376

      Attachments

        Issue Links

          Activity

            People

              sekikn Kengo Seki
              sekikn Kengo Seki
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m