skip to Main Content

I have followed the official instructions to create a sample project from
start.spring.io, in order to build natively a simple project with Spring Boot 3 native support.

As per Help.md, I run: mvn spring-boot:build-image -Pnative

This presented the 1st issue, which was resolved with adding <BP_JVM_VERSION>17.0.7</BP_JVM_VERSION>:

Pom.xml ->


    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>3.1.3</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.example</groupId>
        <artifactId>demo2</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>demo2</name>
        <description>Demo project for Spring Boot</description>
        <properties>
            <java.version>17</java.version>
        </properties>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.graalvm.buildtools</groupId>
                    <artifactId>native-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <image>
                            <env>
                                <BP_JVM_VERSION>17.0.7</BP_JVM_VERSION>
                            </env>
                        </image>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
    </project>

Again, mvn spring-boot:build-image -Pnative

Error:

[INFO]     [creator]         $BPL_JVM_LOADED_CLASS_COUNT  35% of classes                                               the number of loaded classes in memory calculation
[INFO]     [creator]         $BPL_JVM_THREAD_COUNT        250                                                          the number of threads in memory calculation
[INFO]     [creator]         $JAVA_TOOL_OPTIONS                                                                        the JVM launch flags
[INFO]     [creator]         Using Java version 17.0.7 from BP_JVM_VERSION
[INFO]     [creator]       BellSoft Liberica NIK 17.0.7: Contributing to layer
[INFO]     [creator]         Downloading from https://download.bell-sw.com/vm/23.0.0/bellsoft-liberica-vm-core-openjdk17.0.7+7-23.0.0+1-linux-amd64.tar.gz
[INFO]     [creator]         Verifying checksum
[INFO]     [creator]         Expanding to /layers/paketo-buildpacks_bellsoft-liberica/native-image-svm
[INFO]     [creator]         Adding 137 container CA certificates to JVM truststore
[INFO]     [creator]         Writing env.build/JAVA_HOME.override
[INFO]     [creator]         Writing env.build/JDK_HOME.override
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for Syft 1.32.1
[INFO]     [creator]       https://github.com/paketo-buildpacks/syft
[INFO]     [creator]         Downloading from https://github.com/anchore/syft/releases/download/v0.84.0/syft_0.84.0_linux_amd64.tar.gz
[INFO]     [creator]     unable to invoke layer creator
[INFO]     [creator]     unable to get dependency syft
[INFO]     [creator]     unable to download https://github.com/anchore/syft/releases/download/v0.84.0/syft_0.84.0_linux_amd64.tar.gz
[INFO]     [creator]     unable to request https://github.com/anchore/syft/releases/download/v0.84.0/syft_0.84.0_linux_amd64.tar.gz
[INFO]     [creator]     Get "https://objects.githubusercontent.com/github-production-release-asset-2e65be/262126497/8843f979-4bbc-45f6-83aa-3c2caecca78b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230831T102224Z&X-Amz-Expires=300&X-Amz-Signature=f90c330a24191361e399e3aa9e92f9a5659a0708dbf240bf54ca2eaa484bb8ff&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=262126497&response-content-disposition=attachment%3B%20filename%3Dsyft_0.84.0_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream": dial tcp: lookup objects.githubusercontent.com: i/o timeout
[INFO]     [creator]     ERROR: failed to build: exit status 1

Has anyone had this?

PS.
Windows 10, Docker Desktop (latest), Intellij Community 2023.2.1
I tried without firewall also.

2

Answers


  1. I had the same issue, the https://objects.githubusercontent.com url works in the browser and downloads the relevant file. However, it was only during the build the lookup failed.

    I connected to a VPN (Private Internet Access in my case) and the build succeeded when I ran the command again. I suspect it’s something related to a DNS issue.

    Login or Signup to reply.
  2. You might be able to fix it by setting adding the following line to the Docker Engine config file "dns": ["1.1.1.1","8.8.8.8"], as suggested in this related answer.

    The issue seems to be fairly recent and occurring in both macOS and Windows docker desktop. It’s possible this is a newly introduced bug in Docker.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search