报错为
org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
我这边往下翻发现
Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.
BeanCreationException: Error creating bean with name ‘dataSource‘ defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans
由于pom.xml中添加了jpa依赖,所以需要加载datasource,手动在application.properties中添加datasouce相关信息即可
例如
#spring.datasource.url=jdbc:mysql://bj-cdb-nivnaury.sql.tencentcdb.com:****/lianmai?autoReconnect=true&useSSL=FALSE #spring.datasource.username=lyc #spring.datasource.password=**** #spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver ## Specify the DBMS #spring.jpa.database = MYSQL ## Show or not log for each sql query #spring.jpa.show-sql = true ## Hibernate ddl auto (create, create-drop, update) #spring.jpa.hibernate.ddl-auto = update ## Naming strategy #spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy ## stripped before adding them to the entity manager) #spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
再次启动tomcat,正常启动
原文:https://www.cnblogs.com/YC-L/p/14300231.html