巫师的蜕变

导航

 
创建完成第一个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)

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

下面继续....

番外篇

posted on 2019-01-09 21:31  jacunjpg  阅读(5502)  评论(0编辑  收藏  举报