解决 eclipse java web 项目启动时的一些问题
2020-05-27 本文已影响0人
思想永不平凡
本篇针对 eclipse java web 项目启动时出现的一些问题给予一些解决方法,仅供参考。
IDE:Eclipse IDE for Enterprise Java Developers.
工具:jdk1.8,maven,tomcat9.0,mysql8.0
问题描述:

出现以下问题:

2020-05-27 17:46:55.762 WARN 1548 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-05-27 17:46:56.260 ERROR 1548 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8080 was already in use.
Action:
Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
一种方法可以尝试换端口,或者把占用的端口的进程 kill 掉。
如果不能解决,可能是配置文件出现了问题。
打开.properties
文件,如果有:
spring.datasource.url =jdbc:mysql://localhost:3306/数据库名称?serverTimezone=UTC&useLegacyDatetimeCode=false
spring.datasource.username =用户名
spring.datasource.password =密码
确保数据库名称,用户名,密码配置正确。
之后,在配置文件中添加:
spring.jpa.open-in-view=false
server.port=8080
port改成你自己的,默认是8080。
重新按之前的方式启动。
未报错:

这个时候启动的项目,web服务并没有独立处理,它绑定了tomcat。
如果想独立出来,还得有其他操作,这里就不作介绍了。