Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building 'spring-boot-with-jib' sample fails with NoSuchMethodError #1384

Closed
calohmn opened this issue Sep 30, 2020 · 4 comments · Fixed by #1386
Closed

Building 'spring-boot-with-jib' sample fails with NoSuchMethodError #1384

calohmn opened this issue Sep 30, 2020 · 4 comments · Fixed by #1386
Milestone

Comments

@calohmn
Copy link

calohmn commented Sep 30, 2020

Description

When going through the Spring Boot Sample with JIB Build Mode page and running mvn docker:build, building the image fails with a NoSuchMethodError:

JIB> Getting manifest for base image fabric8/java-centos-openjdk8-jdk:1.5.6...                                               
JIB> Building  layer...                                                                                                      
JIB> Building  layer...                                                                                                      
JIB> [=========                     ] 30,0% complete > building  layer
[ERROR] DOCKER> Unable to build the image tarball: : java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'org.apache.http.client.config.RequestConfig$Builder org.apache.http.client.config.RequestConfig$Builder.setNormaJIB> [============                  ] 40,0% complete > building image to tar file
[ERROR] DOCKER> Error when building JIB image [java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'org.apache.http.client.config.RequestConfig$Builder org.apache.http.client.config.RequestConfig$Builder.setNormalizeUri(boolean)']
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Full stack trace
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.34.1:build (default-cli) on project dmp-sample-spring-boot-jib: Error when building JIB image: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'org.apache.http.client.config.RequestConfig$Builder org.apache.http.client.config.RequestConfig$Builder.setNormalizeUri(boolean)' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:docker-maven-plugin:0.34.1:build (default-cli) on project dmp-sample-spring-boot-jib: Error when building JIB image
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error when building JIB image
    at io.fabric8.maven.docker.service.JibBuildService.build (JibBuildService.java:81)
    at io.fabric8.maven.docker.BuildMojo.proceedWithJibBuild (BuildMojo.java:92)
    at io.fabric8.maven.docker.BuildMojo.proceedWithBuildProcess (BuildMojo.java:84)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag (BuildMojo.java:79)
    at io.fabric8.maven.docker.BuildMojo.processImageConfig (BuildMojo.java:151)
    at io.fabric8.maven.docker.BuildMojo.executeInternal (BuildMojo.java:68)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:248)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.IllegalStateException: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'org.apache.http.client.config.RequestConfig$Builder org.apache.http.client.config.RequestConfig$Builder.setNormalizeUri(boolean)'
    at io.fabric8.maven.docker.util.JibServiceUtil.buildContainer (JibServiceUtil.java:90)
    at io.fabric8.maven.docker.service.JibBuildService.build (JibBuildService.java:77)
    at io.fabric8.maven.docker.BuildMojo.proceedWithJibBuild (BuildMojo.java:92)
    at io.fabric8.maven.docker.BuildMojo.proceedWithBuildProcess (BuildMojo.java:84)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag (BuildMojo.java:79)
    at io.fabric8.maven.docker.BuildMojo.processImageConfig (BuildMojo.java:151)
    at io.fabric8.maven.docker.BuildMojo.executeInternal (BuildMojo.java:68)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:248)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'org.apache.http.client.config.RequestConfig$Builder org.apache.http.client.config.RequestConfig$Builder.setNormalizeUri(boolean)'
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue (AbstractFuture.java:564)
    at com.google.common.util.concurrent.AbstractFuture.get (AbstractFuture.java:545)
    at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get (FluentFuture.java:88)
    at com.google.cloud.tools.jib.builder.steps.StepsRunner.lambda$buildImage$8 (StepsRunner.java:344)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:125)
    at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:69)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:78)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)
Caused by: java.lang.NoSuchMethodError: 'org.apache.http.client.config.RequestConfig$Builder org.apache.http.client.config.RequestConfig$Builder.setNormalizeUri(boolean)'
    at com.google.api.client.http.apache.v2.ApacheHttpRequest.<init> (ApacheHttpRequest.java:42)
    at com.google.api.client.http.apache.v2.ApacheHttpTransport.buildRequest (ApacheHttpTransport.java:179)
    at com.google.api.client.http.apache.v2.ApacheHttpTransport.buildRequest (ApacheHttpTransport.java:58)
    at com.google.api.client.http.HttpRequest.execute (HttpRequest.java:889)
    at com.google.cloud.tools.jib.http.FailoverHttpClient.call (FailoverHttpClient.java:317)
    at com.google.cloud.tools.jib.http.FailoverHttpClient.call (FailoverHttpClient.java:244)
    at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:139)
    at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:115)
    at com.google.cloud.tools.jib.registry.RegistryClient.callRegistryEndpoint (RegistryClient.java:573)
    at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest (RegistryClient.java:386)
    at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest (RegistryClient.java:390)
    at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.pullBaseImage (PullBaseImageStep.java:194)
    at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call (PullBaseImageStep.java:126)
    at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call (PullBaseImageStep.java:56)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:125)
    at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:69)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:78)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)

In the pom of the 'spring-boot-with-jib' sample, the d-m-p version is set to "0.33-SNAPSHOT". I've set the version to 0.34.1 and alternatively 0.34-SNAPSHOT and got the above error.

In GoogleContainerTools/jib#2321, the same exception is described, pointing to a conflict concerning the org.apache.httpcomponents:httpclient dependency.

It looks like the version in d-m-p

    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>4.5.5</version>
    </dependency>

is in conflict with the one in com.google.cloud.tools:jib-core:0.15.0 (4.5.10).

Changing the above dependency to version 4.5.10 seems to fix the above problem.

Info

  • d-m-p version : 0.34.1, 0.34-SNAPSHOT
  • Maven version (mvn -v) : 3.6.0
@rohanKanojia
Copy link
Member

rohanKanojia commented Sep 30, 2020

Do you face same issue on 0.34.0? I think #1378 broke jib support

@rohanKanojia
Copy link
Member

Would you like to create a PR to fix this?

@calohmn
Copy link
Author

calohmn commented Sep 30, 2020

Do you face same issue on 0.34.0? I think #1378 broke jib support

@rohanKanojia On 0.34.0 the issue indeed doesn't occur.
Would be great if you could fix this.

@rohanKanojia
Copy link
Member

@calohmn : ohk, let me try to find time to provide a fix and integration test so that it doesn't happen in future.

rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this issue Oct 2, 2020
…thodEror

+ Updating jib-core to 0.15.0 broke our current JIB support due to
  incompatibility with httpclient. Updated apache httpclient to 4.5.10
+ Somehow behavior of Jib setting ImageFormat has been changed(maybe it was
  not working earlier. Introduced a new parameter in mojo `docker.build.jib.imageFormat`
  to allow users specify image format(OCI or Docker) with Docker as
  default ImageFormat.
+ Minor Cleanup in Integration tests; Added an integration test for JIB mode
  which builds image tarball and verifies it by loading into docker daemon

This should also fix fabric8io#1385
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this issue Oct 2, 2020
…thodEror

+ Updating jib-core to 0.15.0 broke our current JIB support due to
  incompatibility with httpclient. Updated apache httpclient to 4.5.10
+ Somehow behavior of Jib setting ImageFormat has been changed(maybe it was
  not working earlier. Introduced a new parameter in mojo `docker.build.jib.imageFormat`
  to allow users specify image format(OCI or Docker) with Docker as
  default ImageFormat.
+ Minor Cleanup in Integration tests; Added an integration test for JIB mode
  which builds image tarball and verifies it by loading into docker daemon

This should also fix fabric8io#1385
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this issue Oct 2, 2020
…thodEror

+ Updating jib-core to 0.15.0 broke our current JIB support due to
  incompatibility with httpclient. Updated apache httpclient to 4.5.10
+ Somehow behavior of Jib setting ImageFormat has been changed(maybe it was
  not working earlier. Introduced a new parameter in mojo `docker.build.jib.imageFormat`
  to allow users specify image format(OCI or Docker) with Docker as
  default ImageFormat.
+ Minor Cleanup in Integration tests; Added an integration test for JIB mode
  which builds image tarball and verifies it by loading into docker daemon

This should also fix fabric8io#1385
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this issue Oct 2, 2020
…thodEror

+ Updating jib-core to 0.15.0 broke our current JIB support due to
  incompatibility with httpclient. Updated apache httpclient to 4.5.10
+ Somehow behavior of Jib setting ImageFormat has been changed(maybe it was
  not working earlier. Introduced a new parameter in mojo `docker.build.jib.imageFormat`
  to allow users specify image format(OCI or Docker) with Docker as
  default ImageFormat.
+ Minor Cleanup in Integration tests; Added an integration test for JIB mode
  which builds image tarball and verifies it by loading into docker daemon

This should also fix fabric8io#1385
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this issue Oct 2, 2020
…thodEror

+ Updating jib-core to 0.15.0 broke our current JIB support due to
  incompatibility with httpclient. Updated apache httpclient to 4.5.10
+ Somehow behavior of Jib setting ImageFormat has been changed(maybe it was
  not working earlier. Introduced a new parameter in mojo `docker.build.jib.imageFormat`
  to allow users specify image format(OCI or Docker) with Docker as
  default ImageFormat.
+ Minor Cleanup in Integration tests; Added an integration test for JIB mode
  which builds image tarball and verifies it by loading into docker daemon

This should also fix fabric8io#1385
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this issue Oct 2, 2020
…thodEror

+ Updating jib-core to 0.15.0 broke our current JIB support due to
  incompatibility with httpclient. Updated apache httpclient to 4.5.10
+ Somehow behavior of Jib setting ImageFormat has been changed(maybe it was
  not working earlier. Introduced a new parameter in mojo `docker.build.jib.imageFormat`
  to allow users specify image format(OCI or Docker) with Docker as
  default ImageFormat.
+ Minor Cleanup in Integration tests; Added an integration test for JIB mode
  which builds image tarball and verifies it by loading into docker daemon

This should also fix fabric8io#1385
rhuss added a commit that referenced this issue Oct 10, 2020
…1386)

+ Updating jib-core to 0.15.0 broke our current JIB support due to
  incompatibility with httpclient. Updated apache httpclient to 4.5.10
+ Somehow behavior of Jib setting ImageFormat has been changed(maybe it was
  not working earlier. Introduced a new parameter in mojo `docker.build.jib.imageFormat`
  to allow users specify image format(OCI or Docker) with Docker as
  default ImageFormat.
+ Minor Cleanup in Integration tests; Added an integration test for JIB mode
  which builds image tarball and verifies it by loading into docker daemon

This should also fix #1385

Co-authored-by: Roland Huß <roland@ro14nd.de>
@rohanKanojia rohanKanojia added this to the 0.35.0 milestone Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants