나는'm new 을 봄 부팅과 오류를 실행하는 동안 내 응용 프로그램이 있습니다. 나는'm 은 다음 중 하나이며,나는'm 는 적절한 부모와 종속성으로 POM,저를 도와주세요
주요 클래스:
package com.boot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* Hello world!
*
*/
@SpringBootApplication
public class App
{
public static void main( String[] args )
{
SpringApplication.run(App.class, "hello");
}
}
오류 메시지는 다음과 같습니다.
org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat servlet container
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:165) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at com.boot.App.main(App.java:18) [classes/:na]Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:159) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
... 10 common frames omitted
POM:
<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>com.boot</groupId>
<artifactId>das-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.1.RELEASE</version>
</parent>
<name>das-boot</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
내 조건을 받았을 때에는 예외"할 수 없을 시작하는 임베디드 Tomcat servlet 컨테이너",
나는 디버그 모드의 봄 부팅을 추가하여debug=true
응용 프로그램에서입니다.속성
다음 다시 실행 코드,그리고 그것을 나에게 말했는java.랭.NoSuchMethodError:javax.servlet.ServletContext.getVirtualServerName()Ljava/eng/문자열
따라서,우리가 알고 있는 아마도 나는'm 를 사용하여 servlet API 의 낮은 버전과 충돌 봄 부팅 버전입니다.
아 pom.xml 하고,발견의 종속성을 사용하여 servlet2.5, 고 나가지 않습니다.
지금 그것을 작동합니다. 도움이 되기를 바랍니다.
간단한 방법이 포함되 이에 응용 프로그램입니다.특성 또는.yml file:
서버입니다.port=0
합니다.특성 그리고서버입니다.port:0
합니다.yml 파일이 있습니다. 물론 알고 있어야 이에 따라 변경될 수 있습니다 springboot 버전을 사용하고 있습니다.
이러한을 허용할 것입니다 당신의 기계를 동적으로 할당하는 모든 포트를 사용할 수 있습니다.
정적으로 할당 포트를 변경하서버입니다.port=someportnumber
. 실행하는 경우 유닉스 기반의 OS 을 확인할 수 있습 좀비 활동에서 포트에서 질문하고 가능한 경우 죽은 그것을 사용하여융합기-k{theport}/tcp
.
니다.yml 또는.특성이 다음과 같이 보여야 합니다.
server: 포트:8089 servlet: 컨텍스트-path:/somecontextpath