首页 新闻 会员 周边

Spring Boot配置Jetty启用失败了

0
悬赏园豆:5 [已解决问题] 解决于 2018-11-04 14:17

S.B.默认的是Tomcat服务器,想体验下Jetty的使用,按照教程做了配置,很简单,更改pom.xml文件即可,可是,配置完毕后,Jetty却没有运行起来、程序也没有运行起来。

百思不得其解啊。

我的S.B.的版本是2.0.6,网络上的一个版本是1.5.8,可以参考我最新发布的博文。

更改后的pom.xml文件:
<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>

启动后的信息如下——和网络上的资料说的 启动成功的信息 相差十万八千里呢:
2018-11-04 12:58:36.491 INFO 12360 --- [ main] com.example.demo.Demo2Application :
Starting Demo2Application on DESKTOP-F6FLB0T with PID 12360 (D:\eclipse\workspace\demo-2\target\classes
started by log in D:\eclipse\workspace\demo-2)
2018-11-04 12:58:36.494 INFO 12360 --- [ main] com.example.demo.Demo2Application :
No active profile set, falling back to default profiles: default
2018-11-04 12:58:36.530 INFO 12360 --- [ main] s.c.a.AnnotationConfigApplicationContext :
Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@6646153: startup
date [Sun Nov 04 12:58:36 CST 2018]; root of context hierarchy
2018-11-04 12:58:37.233 INFO 12360 --- [ main] o.s.j.e.a.AnnotationMBeanExporter :
Registering beans for JMX exposure on startup
2018-11-04 12:58:37.249 INFO 12360 --- [ main] com.example.demo.Demo2Application :
Started Demo2Application in 0.974 seconds (JVM running for 1.701)
2018-11-04 12:58:37.252 INFO 12360 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext :
Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@6646153: startup date
[Sun Nov 04 12:58:36 CST 2018]; root of context hierarchy
2018-11-04 12:58:37.255 INFO 12360 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter :
Unregistering JMX-exposed beans on shutdown

请问,要怎么解决这个问题呢?

快乐的凡人721的主页 快乐的凡人721 | 老鸟四级 | 园豆:3916
提问于:2018-11-04 13:44
< >
分享
最佳答案
0

和Maven仓库有关。
新建一个Maven仓库——空文件夹,然后,重启Eclipse,再执行项目,成功使用Jetty启动了。
晕!晕!晕!
怎么可以这样啊!看来Maven真的存在不少问题啊——之前听说过!
----
2018-11-04 14:15:53.985 INFO 10172 --- [ main] o.e.jetty.server.AbstractConnector :
Started ServerConnector@181d7f28{HTTP/1.1,[http/1.1]}{0.0.0.0:8081}
2018-11-04 14:15:53.988 INFO 10172 --- [ main] o.s.b.web.embedded.jetty.JettyWebServer :
Jetty started on port(s) 8081 (http/1.1) with context path '/'
2018-11-04 14:15:53.992 INFO 10172 --- [ main] com.example.demo.Demo2Application :
Started Demo2Application in 1.927 seconds (JVM running for 2.717)

快乐的凡人721 | 老鸟四级 |园豆:3916 | 2018-11-04 14:17
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册