Software⏱️ 2 min read📅 2026-05-31

How to Fix: ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

Spring Batch application fails to start on Linux server due to missing ServletWebServerFactory bean.

Quick Answer: Ensure the correct dependencies are included in the classpath and verify that the Spring Boot configuration is correct for a non-web application.

The ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean is a common issue in Spring Boot applications. The problem arises when the ServletWebServerFactory bean is not properly configured or not present in the application context.

🚀 How to Resolve This Issue

Method 1: Using Spring Boot's Default Configuration

  1. Step 1: Add the following configuration to your application.properties or application.yml file:
spring.servlet.webengine=jetty

Method 2: Manually Configuring ServletWebServerFactory

  1. Step 1: Create a new configuration class that extends WebServerFactoryConfigurer and add the following code:
@Configuration public class CustomWebServerFactoryConfigurer implements WebServerFactoryConfigurer { @Override public void configure(WebServerFactoryConfigurer configurer, Environment environment) throws Exception { configurer.register(new ServletWebServerFactoryConfigurer() { @Override public void configure(DefaultServletConfigurer.Builder builder) { builder.enableDefaultWebFeatures(); } }); } }

✨ Wrapping Up

By following these methods, you should be able to resolve the ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions