第一个Spring Boot程序启动报错了

创建完成第一个Spring Boot项目后,准备运行,尝一下胜利的果实。
启动日志如下
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.1.RELEASE)

2019-01-09 21:10:41.812  INFO 11644 --- [           main] com.example.demo01.Demo01Application     : Starting Demo01Application on 20180528-132245 with PID 11644 (D:\SpringBoot\project\demo01\target\classes started by Administrator in D:\SpringBoot\project\demo01)
2019-01-09 21:10:41.821  INFO 11644 --- [           main] com.example.demo01.Demo01Application     : No active profile set, falling back to default profiles: default
2019-01-09 21:10:43.160  INFO 11644 --- [           main] com.example.demo01.Demo01Application     : Started Demo01Application in 1.955 seconds (JVM running for 3.395)

Process finished with exit code 0
没有报错,但是,这是一个web项目,为什么自己就结束了呢?
查阅资料(百度)
发现 pom文件有问题,这里不啰嗦,直接上代码
<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
			<scope>provided</scope>
		</dependency>    
pom文件中有这个依赖,这个是什么意思呢?
简单来说就是:我把外部的一个tomcat引入了。
这下你明白了吧,spring boot内部本来就有一个。你现在又引入了一个,这下出问题了。
解决方案:
把上述代码做掉(删除)。问题解决
重新启动项目:
日志如下
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.1.RELEASE)

2019-01-09 21:12:18.385  INFO 6780 --- [           main] com.example.demo01.Demo01Application     : Starting Demo01Application on 20180528-132245 with PID 6780 (D:\SpringBoot\project\demo01\target\classes started by Administrator in D:\SpringBoot\project\demo01)
2019-01-09 21:12:18.391  INFO 6780 --- [           main] com.example.demo01.Demo01Application     : No active profile set, falling back to default profiles: default
2019-01-09 21:12:19.851  INFO 6780 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-01-09 21:12:19.875  INFO 6780 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-01-09 21:12:19.875  INFO 6780 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/9.0.13
2019-01-09 21:12:19.882  INFO 6780 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\Program Files\Java\jdk1.8.0_172\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\Python37;D:\Program Files (x86)\Sybase\PowerDesigner 16;D:\oracle\product\10.2.0\db_1\bin;D:\app\Administrator\product\11.2.0\client_1;D:\maven\apache-maven-3.5.0\bin;D:\Program Files\Java\jdk1.7.0_80\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;D:\Program Files\EmEditor;D:\Python37\Scripts;D:\Python37\Lib\site-packages\Django-2.1.2-py3.7.egg\django;D:\Program Files\Git\cmd;D:\Python37\Scripts\;D:\Python37\;.]
2019-01-09 21:12:20.011  INFO 6780 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-01-09 21:12:20.011  INFO 6780 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1530 ms
2019-01-09 21:12:20.236  INFO 6780 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-01-09 21:12:20.463  INFO 6780 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-01-09 21:12:20.469  INFO 6780 --- [           main] com.example.demo01.Demo01Application     : Started Demo01Application in 2.713 seconds (JVM running for 3.954)

 未完待续。。。。。。。。。

下面继续....

番外篇

转载于:https://www.cnblogs.com/zjiacun/p/10246975.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值