java - Error : Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean -
i have created spring boot application , working fine in eclipse ide, when trying build standalone jar maven, giving me error.
my pom :
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>org.springframework</groupid> <artifactid>rcubems</artifactid> <version>0.1.0</version> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.3.2.release</version> </parent> <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <!-- tag::actuator[] --> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-actuator</artifactid> </dependency> <!-- end::actuator[] --> <!-- tag::tests[] --> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> <!-- end::tests[] --> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-mongodb</artifactid> </dependency> <dependency> <groupid>com.google.guava</groupid> <artifactid>guava</artifactid> <version>19.0</version> </dependency> <dependency> <groupid>joda-time</groupid> <artifactid>joda-time</artifactid> <version>2.9.1</version> </dependency> </dependencies> <properties> <java.version>1.7</java.version> <start-class>com.my.rcms.application</start-class> </properties> <build> <plugins> <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> </plugin> <plugin> <artifactid>maven-failsafe-plugin</artifactid> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactid>maven-assembly-plugin</artifactid> <configuration> <archive> <manifest> <mainclass>com.my.rcms.application</mainclass> </manifest> </archive> <descriptorrefs> <descriptorref>jar-with-dependencies</descriptorref> </descriptorrefs> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <repositories> <repository> <id>spring-releases</id> <name>spring releases</name> <url>https://repo.spring.io/libs-release</url> </repository> </repositories> <pluginrepositories> <pluginrepository> <id>spring-releases</id> <name>spring releases</name> <url>https://repo.spring.io/libs-release</url> </pluginrepository> </pluginrepositories> </project>
my main class :
@springbootapplication public class application { public static void main(string[] args) { applicationcontext ctx = springapplication.run(application.class, args); } }
and found out that, dependency created following 2 commands
* mvn clean install * mvn clean compile assembly:single
resulting jar dependency, not including normal jar in it. appreciated.
error trace :
org.springframework.context.applicationcontextexception: unable start embedded container; nested exception org.springframework.context.applicationcontextexception: unable start embeddedwebapplicationcontext due missing embeddedservletcontainerfactory bean. @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.onrefresh(embeddedwebapplicationcontext.java:133) ~[rcubems-0.1.0-jar-with-dependencies.jar:na] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:532) ~[rcubems-0.1.0-jar-with-dependencies.jar:na] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:118) ~[rcubems-0.1.0-jar-with-dependencies.jar:na] @ org.springframework.boot.springapplication.refresh(springapplication.java:766) [rcubems-0.1.0-jar-with-dependencies.jar:na] @ org.springframework.boot.springapplication.createandrefreshcontext(springapplication.java:361) [rcubems-0.1.0-jar-with-dependencies.jar:na] @ org.springframework.boot.springapplication.run(springapplication.java:307) [rcubems-0.1.0-jar-with-dependencies.jar:na] @ org.springframework.boot.springapplication.run(springapplication.java:1191) [rcubems-0.1.0-jar-with-dependencies.jar:na] @ org.springframework.boot.springapplication.run(springapplication.java:1180) [rcubems-0.1.0-jar-with-dependencies.jar:na] @ com.my.rcms.application.main(application.java:12) [rcubems-0.1.0-jar-with-dependencies.jar:na] caused by: org.springframework.context.applicationcontextexception: unable start embeddedwebapplicationcontext due missing embeddedservletcontainerfactory bean. @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.getembeddedservletcontainerfactory(embeddedwebapplicationcontext.java:185) ~[rcubems-0.1.0-jar-with-dependencies.jar:na] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.createembeddedservletcontainer(embeddedwebapplicationcontext.java:158) ~[rcubems-0.1.0-jar-with-dependencies.jar:na] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.onrefresh(embeddedwebapplicationcontext.java:130) ~[rcubems-0.1.0-jar-with-dependencies.jar:na] ... 8 common frames omitted
i had same problem. resolved adding following dependency:
<properties> <jetty.version>9.2.17.v20160517</jetty.version> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-jetty</artifactid> </dependency>
hope helps (although had problem long ago).
Comments
Post a Comment