Skip to content

NullPointerException during native image build when using @SpringBootApplication #45791

@MiguelAntonioRS

Description

@MiguelAntonioRS

Describe the bug

When building a native image using GraalVM Native Image with a basic Spring Boot application annotated with @SpringBootApplication, a NullPointerException occurs during the build process.

Environment

  • Spring Boot version: 3.2.0
  • Java version: 17 (GraalVM 21.1.0)
  • Build tool: Maven 3.8.6
  • OS: macOS Ventura 13.6 (also reproduced on Ubuntu 22.04)
  • Native Image Maven Plugin version: 0.9.23

To Reproduce

  1. Create a minimal Spring Boot app with only:
    @SpringBootApplication
    public class DemoApplication {
        public static void main(String[] args) {
            SpringApplication.run(DemoApplication.class, args);
        }
    }

Add Spring Boot Native dependency:

org.springframework.boot spring-boot-starter-native

Activity

wilkinsona

wilkinsona commented on Jun 4, 2025

@wilkinsona
Member

Thanks for the report, but Spring Boot 3.2.0 is no longer supported. Please upgrade to a supported version (ideally 3.4.x or later as support for 3.3.x ends at the end of this month).

If the problem still occurs with a supported version and you would like us to investigate further, please provide the complete stack trace of the exception and a minimal sample that reproduces the problem without changes.

MananG-dev

MananG-dev commented on Jun 4, 2025

@MananG-dev

Yeah, may be this issue exists due to previous version you're working in. Even, spring 3.2.x version requires GraalVM 22.3 or higher for native image support. Have a look: https://docs.spring.io/spring-boot/how-to/native-image/developing-your-first-application.html

spring-projects-issues

spring-projects-issues commented on Jun 11, 2025

@spring-projects-issues
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

MiguelAntonioRS

MiguelAntonioRS commented on Jun 12, 2025

@MiguelAntonioRS
Author

Hi,
After upgrading to Spring Boot 3.5.0 and using GraalVM 22.3+, the NullPointerException during native image build is resolved. Thanks for your help!

I'm closing this issue as fixed in newer versions. This might help others who are facing similar problems with older Spring Boot versions. 
 Thanks!
added
status: invalidAn issue that we don't feel is valid
and removed
status: feedback-reminderWe've sent a reminder that we need additional information before we can continue
on Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bclozel@wilkinsona@spring-projects-issues@MananG-dev@MiguelAntonioRS

        Issue actions

          NullPointerException during native image build when using @SpringBootApplication · Issue #45791 · spring-projects/spring-boot