I have actually created a spring batch application making use of Spring boot. When I am trying to run that application using command line and classpath on my regional system it is running fine. However, when I tried to run it on linux server it is offering me complying with exception

Unable to start internet server; nested exemption isorg.springframework.conmessage.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to absent ServletWebServerFactory bean.Below is the means I am running it:

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



SpringBootApplication annotation absent in your spring boot starter course.

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

Case 2:

For non-internet applications, disable web application kind in the properties file.

In application.properties:

spring.primary.web-application-type=noneIf you usage application.yml then add:

spring: main: web-application-type: noneFor web applications, exhas a tendency *SpringBootServletInitializer* in the primary course.

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

Case 3:

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



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

The solution is:

I clearly set the below residential or commercial property to none in application.yml file.

spring: main: web-application-type: none
My solution had to perform with a poor dependency. I had:

org.springframe.boot spring-boot-starter-internet org.springstructure.boot spring-boot-starter-tomcat In my pom and also I had to comment out the exclusion to get it functioning. It need to look for this tomcat package for some factor.

You more than likely use this in your project:

org.springframe.boot spring-boot-starter-webfluxin which case you"ll need to also add:

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

PS: that"s because Spring will certainly use by default web-MVC rather of web-flux when both are available

In my case the problem reresolved on commenting the tomcat dependencies exemption from spring-boot-starte-web

org.springframe.boot spring-boot-starter-web
Bean public ServletWebServerFactory servletWebServerFactory() rerotate brand-new TomcatServletWebServerFactory(); I was running non internet spring application using SpringApplication.run(MyApplication.course, args); without
I had actually this trouble throughout migration to Spring Boot. I"ve discovered a advice to rerelocate dependencies and also it helped. So, I rerelocated dependency for jsp-api Project had. Also, servlet-api dependency hregarding be removed as well.

compileOnly group: "javax.servlet.jsp", name: "jsp-api", version: "2.2"
Apart from the feasible services in various other answers, it is additionally possible that somehow Maven dependency corruption has arisen on your machine. I was encountering the exact same error on trying to run my (Web) Spring boot application, and it acquired resolved by running the complying with -

mvn dependency:purge-local-repository -DreResolve=truecomplied with by

mvn packageI came onto this solution looking right into another concern wright here Eclipse wouldn"t let me run the main application course from the IDE, as a result of a different error, equivalent to one on this SO threview -> The type org.springframe.conmessage.ConfigurableApplicationConmessage cannot be resolved. It is indirectly referenced from required .class files

Similar to the solution of making sure org.springstructure.boot:spring-boot-starter-tomcat was mounted, I was absent org.eclipse.jetty:jetty-server from my construct.gradle

org.springframe.boot:spring-boot-starter-web needs a server be it Tomcat, Jetty or somepoint else - it will certainly compile however not run without one.

In instance you"re making use of IntelliJ and this is happening to you (prefer it did to my noob-self), encertain the Run setting has Spring Boot Application and NOT plain Application.

In my case, the difficulty was I didn"t had a Tomcat server separately set up in my eclipse. I assumed my Springboot will start the server instantly within itself.

Since my major class exhas a tendency SpringBootServletInitializer and also override configure strategy, I absolutely require a Tomcat server mounted in my IDE.

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

After installation, run the major class on server.

Run As -> Run on Server
I was trying to produce a internet application with spring boot and also I gained the same error. After inspecting I uncovered that I was lacking a dependency. So, be certain to include following dependency to your pom.xml file.

org.springframe.boot spring-boot-starter-web
I wanted to run the WAR type spring boot application, and also once I was trying to run the application as spring boot application I was obtaining over error. So advertising the web application form in application.properties has actually worked for me.spring.main.web-application-type=none

Possible web application type:

NONE - the application must not run as a web application and also must not begin an installed web server.REACTIVE - the application must run as a reactive web application and also must begin an installed reactive internet server.SERVLET - the application should run as a servlet-based web application and must start an embedded servlet internet server.
I was obtaining same error while making use of tomcat-jasper more recent version

org.apache.tomcat tomcat-jasper 10.0.6I reinserted through the secure older variation it operated fine for me.

org.apache.tomcat tomcat-jasper 9.0.46
I encountered this trouble when attempint to run my internet application as a fat jar quite than from within my IDE (IntelliJ).

This is what functioned for me. Simply including a default profile to the application.properties file.

spring.prorecords.active=defaultYou do not have to use default if you have currently erected various other specific prodocuments (dev/test/prod). But if you haven"t this is essential to run the application as a fat jar.

As for me, I removed the gave scope in tomcat dependency.

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

org.springframe.boot spring-boot-starter-tomcat gave // remove this scope
In my case, I was utilizing an TOMCAT 8 and updating to TOMCAT 9 resolved it:

4.0.0 spring-boot-application spring-boot-app 0.0.1-SNAPSHOT battle org.springframework.boot spring-boot-starter-parent 2.3.1.RELEASE org.springframe.boot spring-boot-starter-internet org.springstructure.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 trouble was the very same as that in the original question, just that I was running by means of Eclipse and not cmd. Tried all the solutions provided, but didn"t work-related. The final functioning solution for me, yet, was while running by means of cmd (or have the right to be run similarly through Eclipse). Used a modified command also appfinished with spring config from cmd:

begin java -Xms512m -Xmx1024m -Dspring.config.location= -jar I guess my issue was the spring configurations not being loaded effectively.

Highly energetic question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer task.

Not the answer you're looking for? Browse other inquiries tagged spring spring-boot spring-mvc or ask your very own question.

Spring Boot: Unable to begin EmbeddedWebApplicationConmessage as a result of lacking EmbeddedServletContainerFactory bean
The form org.springframework.context.ConfigurableApplicationConmessage cannot be reresolved. It is instraight referenced from required .class files
I am obtaining Unable to start ServletWebServerApplicationConmessage because of lacking ServletWebServerFactory bean even with
Deployed Spring Boot war to Tomcat server and also obtained "Unable to begin embedded Tomcat org.springframe.conmessage.ApplicationContextException"
Spring/Java11 - Unable to begin ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
ApplicationContextException: Unable to start EmbeddedWebApplicationConmessage as a result of missing EmbeddedServletContainerFactory bean
Spring boot -- Unable to begin EmbeddedWebApplicationContext due to lacking EmbeddedServletContainerFactory bean