2016-10-06 3 views
1

컨테이너를 사용하는 대신 Tomcat을 사용하여 독립 실행 형 응용 프로그램으로 실행하려고하는 스프링 부트 웹 응용 프로그램이 있습니다.봄 부팅 EmbeddedServletContainerFactory 빈이 없어서 EmbeddedWebApplicationContext를 시작할 수 없습니다.

IntelliJ에서 개발 중이며 실행 구성을 Spring Boot로 설정했으며 응용 프로그램이 IntelliJ에서 실행 중입니다.

IntelliJ에서 JAR 파일을 생성하기 위해 이슈를 생성했으며 Maven의 모든 종속성을 포함하도록 설정했습니다.

그러나 응용 프로그램을 실행할 때 오류가 발생합니다. 내 연구에서

14:52:19.303 [main] ERROR o.s.boot.SpringApplication - Application startup failed 
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean. 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) ~[NatLocApp.jar:na] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[NatLocApp.jar:na] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[NatLocApp.jar:na] 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [NatLocApp.jar:na] 
    at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:347) [NatLocApp.jar:na] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:295) [NatLocApp.jar:na] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1112) [NatLocApp.jar:na] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1101) [NatLocApp.jar:na] 
    at com.nationallocums.Application.main(Application.java:13) [NatLocApp.jar:na] 
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean. 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183) ~[NatLocApp.jar:na] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156) ~[NatLocApp.jar:na] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) ~[NatLocApp.jar:na] 
    ... 8 common frames omitted 

나는이 함께 할 수있는 뭔가가 볼 수 톰캣 포함되지 또는 최종 JAR 파일에 포함 된 톰캣의 인스턴스화 어쩌면 복수,하지만 난 문제를 해결할 수하지 않는 것 .

다음은 내 pom.xml 파일의 모양입니다.

<dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.1</version> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-tomcat</artifactId> 
      <scope>provided</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-jpa</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-security</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-taglibs</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-actuator</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-mail</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.tomcat.embed</groupId> 
      <artifactId>tomcat-embed-jasper</artifactId> 
      <scope>provided</scope> 
     </dependency> 

     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.37</version> 
     </dependency> 

     <dependency> 
      <groupId>com.fasterxml.jackson.core</groupId> 
      <artifactId>jackson-databind</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>jstl</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>commons-fileupload</groupId> 
      <artifactId>commons-fileupload</artifactId> 
      <version>1.3.1</version> 
     </dependency> 

     <dependency> 
      <groupId>commons-io</groupId> 
      <artifactId>commons-io</artifactId> 
      <version>2.4</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-lang3</artifactId> 
      <version>3.4</version> 
     </dependency> 

     <dependency> 
      <groupId>net.sf.opencsv</groupId> 
      <artifactId>opencsv</artifactId> 
      <version>2.3</version> 
     </dependency> 

     <dependency> 
      <groupId>com.google.code.gson</groupId> 
      <artifactId>gson</artifactId> 
      <version>2.4</version> 
     </dependency> 

     <dependency> 
      <groupId>org.jsoup</groupId> 
      <artifactId>jsoup</artifactId> 
      <version>1.9.2</version> 
     </dependency> 
    </dependencies> 
내가 '제공'완전히 범위 태그를 제거하는 범위를 필요로 바람둥이 의존성을 설정하려고했습니다

하지만 둘은 어떤 차이를 만들 것으로 보인다.

답변

1

pom.xml 파일에 spring-boot-maven-plugin이 있어야합니다. 그리고 항아리 포장이 항아리로 설정되었습니다. 그런 다음

을 수행 할 수 있습니다

$ mvn package 
$ java -jar target/mymodule-0.0.1-SNAPSHOT.jar 
+0

내가 이미 시도했다, 그리고 응용 프로그램이 실제로 실행 않습니다, 그러나 그것은 JSP 전혀 보이지 않는다 webapp 폴더의 파일은 생성 된 jar 파일에 포함됩니다. – SheppardDigital

0
<dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-tomcat</artifactId> 
     <scope>provided</scope> 
    </dependency> 

솔루션 :이 줄 삭제 : "<scope>provided</scope>는"

관련 문제