在替换Tomcat而不是Jetty之后,无法在IDEA上运行Spring Boot项目

时间:2017-04-21 09:23:24

标签: maven spring-boot jetty

我是IDEA的新手。当我在IDEA上创建一个Spring Boot项目(Hello World ..)时,默认配置很容易运行。 但是,在替换Tomcat而不是Jetty之后,它无法运行。 我的pom.xml是这样的:

  <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>1.5.2.RELEASE</version>
      <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
      <java.version>1.8</java.version>
    </properties>
    <dependencies>
      <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
          <exclusions>
              <exclusion>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-tomcat</artifactId>
              </exclusion>
          </exclusions>
      </dependency>
      <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-jetty</artifactId>
      </dependency>
      <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-test</artifactId>
          <scope>test</scope>
      </dependency>
    </dependencies>
    <build>
      <plugins>
          <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
          </plugin>
      </plugins>
    </build>

错误信息如下:

2017-04-21 17:10:50.448  INFO 10132 --- [           main] com.example.JettyDemoApplication         : Starting JettyDemoApplication on HuaTai-PC with PID 10132 (E:\aaa_coding-2017\jetty-demo\target\classes started by HuaTai in E:\aaa_coding-2017\jetty-demo)
2017-04-21 17:10:50.451  INFO 10132 --- [           main] com.example.JettyDemoApplication         : No active profile set, falling back to default profiles: default
2017-04-21 17:10:50.548  INFO 10132 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@77ec78b9: startup date [Fri Apr 21 17:10:50 CST 2017]; root of context hierarchy
2017-04-21 17:10:51.610  WARN 10132 --- [           main] o.h.v.m.ParameterMessageInterpolator     : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2017-04-21 17:10:51.858  WARN 10132 --- [           main] o.h.v.m.ParameterMessageInterpolator     : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2017-04-21 17:10:52.291  INFO 10132 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-04-21 17:10:52.305  INFO 10132 --- [           main] com.example.JettyDemoApplication         : Started JettyDemoApplication in 2.241 seconds (JVM running for 2.705)
2017-04-21 17:10:52.306  INFO 10132 --- [       Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@77ec78b9: startup date [Fri Apr 21 17:10:50 CST 2017]; root of context hierarchy
2017-04-21 17:10:52.307  INFO 10132 --- [       Thread-2] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

感谢所有

0 个答案:

没有答案