Skip to content

Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean #47702

@maheshtechlearn

Description

@maheshtechlearn

When running a native image built with Spring Boot and GraalVM, the application fails at startup with:

org.springframework.boot.web.context.MissingWebServerFactoryBeanException:
No qualifying bean of type 'org.springframework.boot.web.servlet.server.ServletWebServerFactory' available

Despite having the proper dependencies (spring-boot-starter-web) declared in pom.xml

i am using the following versions

Spring boot 3.4.10 & java 21

openjdk 21.0.2 2024-01-16
OpenJDK Runtime Environment GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30, mixed mode, sharing)

My application type servlet based so i am giving property as --spring.main.web-application-type=servlet

Getting below exception.

2025-10-19 15:34:10:920  org.springframework.ui.context.support.UiApplicationContextUtils [main] DEBUG - Unable to locate ThemeSource with name 'themeSource': using default [org.springframework.ui.context.support.ResourceBundleThemeSource@7b47f669]
2025-10-19 15:34:10:920  org.springframework.context.support.AbstractApplicationContext [main] WARN  - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server
2025-10-19 15:34:10:920  org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter [main] DEBUG - Application failed to start due to an exception
org.springframework.boot.web.context.MissingWebServerFactoryBeanException: No qualifying bean of type 'org.springframework.boot.web.servlet.server.ServletWebServerFactory' available: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:221)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:191)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:167)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:621)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:318)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350)
        at com.amc.AMCApplication.main(AMCApplication.java:26)
        at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
2025-10-19 15:34:10:920  org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter [main] ERROR -

***************************
APPLICATION FAILED TO START
***************************

Description:

Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context.

Action:

Check your application's dependencies for a supported servlet web server.
Check the configured web application type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: feedback-reminderWe've sent a reminder that we need additional information before we can continuestatus: waiting-for-feedbackWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions