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

docker-java dependency should be shaded in docker-build-step

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Issues:

      • docker-java does not guarantee the backward compatibility across versions (there're binary compatibility violations in the latest releases)
      • sharing of incompatible lib as a plugin is not safe, so we want to setup the shading of the entire docker-java lib
      • if we leave the plugin as is, there's may be a conflict with other plugins using docker-java

      In my case I see the conflict with docker-traceability plugin, which causes classloading errors in build-step, because Jenkins takes the higher version.

      I also have JENKINS-28693 for docker-teaceability

        Attachments

          Issue Links

            Activity

            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Stacktrace example:

            javax.servlet.ServletException: java.util.ServiceConfigurationError: com.github.dockerjava.api.command.DockerCmdExecFactory: Provider com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl not a subtype
            at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)
            at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
            at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
            at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:123)
            at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:114)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
            at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
            at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
            at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:168)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
            at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
            at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
            at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
            at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
            at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
            at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
            at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
            at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
            at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
            at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
            at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
            at org.mortbay.jetty.Server.handle(Server.java:285)
            at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
            at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765)
            at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:628)
            at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
            at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
            at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
            at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
            Caused by: java.util.ServiceConfigurationError: com.github.dockerjava.api.command.DockerCmdExecFactory: Provider com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl not a subtype
            at java.util.ServiceLoader.fail(ServiceLoader.java:239)
            at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
            at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
            at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
            at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
            at com.github.dockerjava.core.DockerClientBuilder.getDefaultDockerCmdExecFactory(DockerClientBuilder.java:43)
            at com.github.dockerjava.core.DockerClientBuilder.build(DockerClientBuilder.java:63)
            at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.createDockerClient(DockerBuilder.java:135)
            at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.configure(DockerBuilder.java:173)
            at jenkins.model.Jenkins.configureDescriptor(Jenkins.java:2893)
            at jenkins.model.Jenkins.doConfigSubmit(Jenkins.java:2856)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:497)
            at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
            at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
            at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
            at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
            at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
            at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
            ... 37 more

            Show
            oleg_nenashev Oleg Nenashev added a comment - Stacktrace example: javax.servlet.ServletException: java.util.ServiceConfigurationError: com.github.dockerjava.api.command.DockerCmdExecFactory: Provider com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl not a subtype at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:123) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:114) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:168) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:285) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:628) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475) Caused by: java.util.ServiceConfigurationError: com.github.dockerjava.api.command.DockerCmdExecFactory: Provider com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl not a subtype at java.util.ServiceLoader.fail(ServiceLoader.java:239) at java.util.ServiceLoader.access$300(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at com.github.dockerjava.core.DockerClientBuilder.getDefaultDockerCmdExecFactory(DockerClientBuilder.java:43) at com.github.dockerjava.core.DockerClientBuilder.build(DockerClientBuilder.java:63) at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.createDockerClient(DockerBuilder.java:135) at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.configure(DockerBuilder.java:173) at jenkins.model.Jenkins.configureDescriptor(Jenkins.java:2893) at jenkins.model.Jenkins.doConfigSubmit(Jenkins.java:2856) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96) at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) ... 37 more
            Hide
            jglick Jesse Glick added a comment -

            Please fix DockerClientBuilder.getDefaultDockerCmdExecFactory to not use ServiceLoader to load its own default implementation. This is a serious antipattern. It should allow foreign implementations to be registered in META-INF/services/com.github.dockerjava.api.command.DockerCmdExecFactory, but fall back to loading DockerCmdExecFactoryImpl nonreflectively.

            Shading the library is a complex workaround. The most straightforward workaround is to adjust createDockerClient to wrap the call to DockerClientBuilder in a try-finally block which temporarily sets the thread context class loader to the loader of DockerClientBuilder (i.e., this plugin’s loader).

            Show
            jglick Jesse Glick added a comment - Please fix DockerClientBuilder.getDefaultDockerCmdExecFactory to not use ServiceLoader to load its own default implementation. This is a serious antipattern. It should allow foreign implementations to be registered in META-INF/services/com.github.dockerjava.api.command.DockerCmdExecFactory , but fall back to loading DockerCmdExecFactoryImpl nonreflectively. Shading the library is a complex workaround. The most straightforward workaround is to adjust createDockerClient to wrap the call to DockerClientBuilder in a try - finally block which temporarily sets the thread context class loader to the loader of DockerClientBuilder (i.e., this plugin’s loader).
            Hide
            danielbeck Daniel Beck added a comment -

            Could whoever reports this issue on the changelog every week please stop doing that? It's not an issue in the Jenkins war or installer downloads, and only distracts from actual issues in them. Thank you.

            Show
            danielbeck Daniel Beck added a comment - Could whoever reports this issue on the changelog every week please stop doing that? It's not an issue in the Jenkins war or installer downloads, and only distracts from actual issues in them. Thank you.
            Hide
            rajyogya015 Yogya Raj added a comment -

            HI ,'
            Please let us know the feasible solution, while trying to do a test connection for Docker Rest API URL it is throwing the error, where jenkins and docker is installed on two different server .

            javax.servlet.ServletException: java.util.ServiceConfigurationError: com.github.dockerjava.api.command.DockerCmdExecFactory: Provider com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl not a subtype
            at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)
            at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
            at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
            at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
            at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
            at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
            at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
            at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
            at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
            at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
            at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:80)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
            at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
            at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)

            Show
            rajyogya015 Yogya Raj added a comment - HI ,' Please let us know the feasible solution, while trying to do a test connection for Docker Rest API URL it is throwing the error, where jenkins and docker is installed on two different server . javax.servlet.ServletException: java.util.ServiceConfigurationError: com.github.dockerjava.api.command.DockerCmdExecFactory: Provider com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl not a subtype at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:80) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)

              People

              • Assignee:
                vjuranek vjuranek
                Reporter:
                oleg_nenashev Oleg Nenashev
              • Votes:
                3 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: