I have actually written a spring batch application utilizing Spring boot. As soon as I am trying to run that application utilizing command line and also classpath on my regional system it is to run fine. However, once I make the efforts to operation it ~ above linux server the is providing me following exception

Unable come start web server; nested exception isorg.springframework.context.ApplicationContextException: can not to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.Below is the means I am to run it:

java -cp jarFileName.jar; lib\* -Dlogging.level.org.springframework=DEBUG -Dspring.profiles.active=dev -Dspring.batch.job.names=abcBatchJob com.aa.bb.StartSpringBatch > somelogs.log



SpringBootApplication annotation lacking in her spring boots starter class.

You are watching: Unable to start servletwebserverapplicationcontext due to missing servletwebserverfactory bean.

Case 2:

For non-web applications, disable net application kind in the nature file.

In application.properties:

spring.main.web-application-type=noneIf you use application.yml climate add:

spring: main: web-application-type: noneFor web applications, extends *SpringBootServletInitializer* in the key class.

SpringBootApplicationpublic class YourAppliationName expand SpringBootServletInitializer public static void main(String<> args) SpringApplication.run(YourAppliationName.class, args);

Case 3:

If you use spring-boot-starter-webflux then also add spring-boot-starter-web as dependency.



SpringBootApplicationpublic course LoginSecurityAppApplication public revolution void main(String<> args) SpringApplication.run(LoginSecurityAppApplication.class, args);

The solution is:

I explicitly collection the listed below property to none in application.yml file.

spring: main: web-application-type: no one
My solution had to carry out with a bad dependency. I had:

org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat In mine pom and also I had actually to comment the end the exclusion to gain it working. It have to look for this tomcat package for part reason.

You probably use this in your project:

org.springframework.boot spring-boot-starter-webfluxin which case you"ll have actually to likewise add:

org.springframework.boot spring-boot-starter-weband the magic happens :)

PS: that"s since Spring will usage by default web-MVC instead of web-flux when both space available

In my situation the problem resolved on commenting the tomcat dependencies exemption from spring-boot-starte-web

org.springframework.boot spring-boot-starter-web
Bean publicly ServletWebServerFactory servletWebServerFactory() return new TomcatServletWebServerFactory(); I was to run non internet spring application making use of SpringApplication.run(MyApplication.class, args); without
I had actually this trouble during hike to feather Boot. I"ve discovered a advice to remove dependencies and also it helped. So, I removed dependency because that jsp-api task had. Also, servlet-api dependency needs to be gotten rid of as well.

compileOnly group: "javax.servlet.jsp", name: "jsp-api", version: "2.2"
Apart indigenous the possible solutions in other answers, it is also possible that somehow Maven dependency corruption has emerged on her machine. I was facing the same error on trying to run my (Web) Spring boot application, and it acquired resolved by to run the following -

mvn dependency:purge-local-repository -DreResolve=truefollowed by

mvn packageI come onto this equipment looking into an additional issue whereby Eclipse wouldn"t allow me run the main application course from the IDE, because of a various error, similar to one ~ above this so thread -> The type org.springframework.context.ConfigurableApplicationContext cannot be resolved. It is indirectly referenced from compelled .class files

Similar to the systems of making certain org.springframework.boot:spring-boot-starter-tomcat to be installed, i was absent org.eclipse.jetty:jetty-server from mine build.gradle

org.springframework.boot:spring-boot-starter-web demands a server it is in it Tomcat, Jetty or something else - it will compile but not run without one.

In instance you"re making use of IntelliJ and this is happening come you (like that did to my noob-self), for sure the Run setup has Spring boot Application and also NOT plain Application.

In my case, the trouble was i didn"t had a Tomcat server individually installed in mine eclipse. Ns assumed mine Springboot will start the server instantly within itself.

Since mine main class extends SpringBootServletInitializer and override configure method, I definitely need a Tomcat server mounted in mine IDE.

To install, very first download Apachce Tomcat (version 9 in my case) and also create server utilizing Servers tab.

After installation, run the main class on server.

Run as -> run on Server
I was trying to produce a internet application through spring boot and I gained the very same error. After ~ inspecting I discovered that i was missing a dependency. So, be sure to add following dependency to her pom.xml file.

org.springframework.boot spring-boot-starter-web
I wanted to operation the WAR type spring boots application, and when i was trying to run the application as feather boot applications I was getting above error. So proclaiming the internet application type in application.properties has functioned for me.spring.main.web-application-type=none

Possible internet application type:

NONE - the application should not operation as a internet application and should not begin an embedded web server.REACTIVE - the application have to run as a reactive internet application and also should begin an embedded reactive internet server.SERVLET - the application must run as a servlet-based internet application and should start an installed servlet net server.
I was getting same error while using tomcat-jasper more recent version

org.apache.tomcat tomcat-jasper 10.0.6I replaced with the steady older version it worked fine for me.

org.apache.tomcat tomcat-jasper 9.0.46
I encountered this problem when attempint to operation my net application as a fat jar quite than from in ~ my ide (IntelliJ).

This is what operated for me. Simply adding a default file to the application.properties file.

spring.profiles.active=defaultYou don"t need to use default if you have actually already collection up other particular profiles (dev/test/prod). But if girlfriend haven"t this is necessary to run the application as a fat jar.

As because that me, I removed the noted scope in tomcat dependency.

See more: Reviewing The Zolt Laptop Charger Plus Makes Traveling Easier

org.springframework.boot spring-boot-starter-tomcat listed // eliminate this scope
In my case, i was making use of an TOMCAT 8 and also updating to TOMCAT 9 solved it:

4.0.0 spring-boot-app spring-boot-app 0.0.1-SNAPSHOT war org.springframework.boot spring-boot-starter-parent 2.3.1.RELEASE org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-data-jpa com.h2database h2 org.springframework.boot spring-boot-starter-test org.codehaus.mojo exec-maven-plugin 1.2.1 java com.example.Application 9.0.37 related issues:

My difficulty was the exact same as that in the initial question, just that ns was running via Eclipse and also not cmd. Tried every the options listed, yet didn"t work. The last working systems for me, however, to be while running via cmd (or deserve to be run similarly via Eclipse). Supplied a modification command appended through spring config from cmd:

start java -Xms512m -Xmx1024m -Dspring.config.location= -jar i guess my concern was the spring configurations no being invited correctly.

Highly energetic question. Earn 10 reputation (not count the association bonus) in order come answer this question. The reputation necessity helps protect this question from spam and non-answer activity.

Not the answer you're feather for? Browse other questions tagged spring spring-boot spring-mvc or asking your own question.

Spring Boot: can not to begin EmbeddedWebApplicationContext early to absent EmbeddedServletContainerFactory bean
The form org.springframework.context.ConfigurableApplicationContext cannot be resolved. That is indirect referenced from compelled .class files
I am acquiring Unable to begin ServletWebServerApplicationContext early out to absent ServletWebServerFactory bean even with
Deployed feather Boot war to Tomcat server and received "Unable to start installed Tomcat org.springframework.context.ApplicationContextException"
Spring/Java11 - unable to start ServletWebServerApplicationContext early to absent ServletWebServerFactory bean
ApplicationContextException: can not to start EmbeddedWebApplicationContext early out to lacking EmbeddedServletContainerFactory bean
Spring boots -- can not to start EmbeddedWebApplicationContext early out to missing EmbeddedServletContainerFactory p