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

NPE in spring-boot-maven-plugin:build-image when setting custom builder that is not a builder #22179

Closed
jcfandino opened this issue Jun 30, 2020 · 2 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@jcfandino
Copy link

jcfandino commented Jun 30, 2020

When I try to set a custom builder in the maven plugin by following the documentation:
https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/html/#build-image-example-custom-image-builder

Like this:

      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <image>
            <builder>gcr.io/paketo-buildpacks/bellsoft-liberica</builder>
          </image>
        </configuration>
      </plugin>

Running ./mvnw spring-boot:build-image fails with the following exception:

Caused by: java.lang.NullPointerException
    at org.springframework.boot.buildpack.platform.docker.type.ImageConfig.parseConfigEnv (ImageConfig.java:52)
    at org.springframework.boot.buildpack.platform.docker.type.ImageConfig.<init> (ImageConfig.java:46)
    at org.springframework.boot.buildpack.platform.docker.type.Image.<init> (Image.java:51)
    at org.springframework.boot.buildpack.platform.json.MappedObject.of (MappedObject.java:148)
    at org.springframework.boot.buildpack.platform.json.MappedObject.of (MappedObject.java:131)
    at org.springframework.boot.buildpack.platform.docker.type.Image.of (Image.java:111)
    at org.springframework.boot.buildpack.platform.docker.DockerApi$ImageApi.pull (DockerApi.java:163)
    at org.springframework.boot.buildpack.platform.build.Builder.pullBuilder (Builder.java:85)
    at org.springframework.boot.buildpack.platform.build.Builder.build (Builder.java:63)
    at org.springframework.boot.maven.BuildImageMojo.buildImage (BuildImageMojo.java:136)
    at org.springframework.boot.maven.BuildImageMojo.execute (BuildImageMojo.java:128)

I made this project to reproduce the error: https://github.com/jcfandino/spring-boot-npe
You can look at the build pipeline to see the error: https://github.com/jcfandino/spring-boot-npe/actions

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 30, 2020
@wilkinsona wilkinsona self-assigned this Jul 1, 2020
@wilkinsona
Copy link
Member

wilkinsona commented Jul 1, 2020

Thanks for the sample, @jcfandino. The cause of the problem is that you are specifying gcr.io/paketo-buildpacks/bellsoft-liberica as a builder when it is an individual buildpack. As a result, the JSON that describes the image does not contain some information that is expected to be there. We don't handle this gracefully which results in the NPE. We need to improve the error handling here.

@wilkinsona wilkinsona changed the title NPE in spring-boot-maven-plugin:build-image when setting custom builder NPE in spring-boot-maven-plugin:build-image when setting custom builder that is not a builder Jul 1, 2020
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 1, 2020
@wilkinsona wilkinsona added this to the 2.3.2 milestone Jul 1, 2020
@jcfandino
Copy link
Author

I see. Thanks for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants