
本文共 1907 字,大约阅读时间需要 6 分钟。
报错为
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,正常启动
之后再次报错
nested exception is liquibase.exception.ChangeLogParseException: Error parsing classpath:/db/changelog/db.changelog-master.yaml
原因在于没有liquibase的配置文件,所以我们自定义配置文件,在pom.xml中添加
org.liquibase liquibase-maven-plugin src/main/resources/liquibase.properties
然后mvn clean下,再install,然后重新build整个project
此时liquibase-mave-plugin报红,需要在build内添加一个 pluginManagement 标签
红色消失
然后启动tomcat又报同样的错,只好在配置文件当前目录下新建文件 db.changelog-master.yaml
最后tomcat成功启动 T T
发表评论
最新留言
关于作者
