Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39689

Docker-java shaded jar should not embed an old version of tiger_types (used by Stapler)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • docker-plugin
    • None

      Hey,
      Twiddling with the plugin as a dependency, I was hitting a weird NoSuchMethodError apparently in tiger_types, a low level library used by Stapler during mvn clean test on Jenkins 2.19.2.

      I was able to narrow down this error to upgrading between Jenkins 2.1 and Jenkins 2.2:

      • this version includes an update of Stapler from 1.239 to 1.243.
      • Stapler upgraded its dependency onto tiger_types from 1.3 to 2.2. In that update, there was a change on the Types.bind() method (which you see in the stack below).

      After digging into it, I finally found the docker-java-shaded java indeed included an old version of tiger_types (1.3 probably, which is why this didn't cause any issue until Jenkins 2.2 where that lib got modified/upgraded).

      Nov 12, 2016 10:30:04 AM org.eclipse.jetty.servlet.ServletHandler doHandle
      WARNING: Error for /closures/
      java.lang.NoSuchMethodError: org.jvnet.tiger_types.Types.bind(Ljava/lang/reflect/Type;Ljava/lang/reflect/GenericDeclaration;Ljava/lang/reflect/ParameterizedType;)Ljava/lang/reflect/Type;
      	at org.kohsuke.stapler.ClassDescriptor.findMethods(ClassDescriptor.java:155)
      	at org.kohsuke.stapler.ClassDescriptor.findMethods(ClassDescriptor.java:142)
      	at org.kohsuke.stapler.ClassDescriptor.<init>(ClassDescriptor.java:84)
              ...
      

      The spurious tiger_types old version classes come from hk2-utils, which is coming from the jersey-client dependency:

      mvn dependency:tree -Dincludes="*:hk2-utils"
      Warning: JAVA_HOME environment variable is not set.
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building Docker-java shaded jar for jenkins plugin 0.16.3-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ docker-java-shaded ---
      [INFO] com.nirima:docker-java-shaded:jar:0.16.3-SNAPSHOT
      [INFO] \- org.glassfish.jersey.core:jersey-client:jar:2.23.1:compile
      [INFO]    \- org.glassfish.hk2:hk2-api:jar:2.4.0-b34:compile
      [INFO]       \- org.glassfish.hk2:hk2-utils:jar:2.4.0-b34:compile
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1.373 s
      [INFO] Finished at: 2016-11-12T15:13:02+01:00
      [INFO] Final Memory: 16M/298M
      

      I think at least tiger_types should be filtered out the shaded über-jar, to not conflict with the one used by Stapler.

      I am going to file a PR for that today.

      Thanks!

            magnayn magnayn
            batmat Baptiste Mathus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: