lifecoach2020 2023-02-07 21:47 采纳率: 72.7%
浏览 56
已结题

使用spring boot 写了一个简单的后端程序但无法运行

使用spring boot 写了一个简单的后端程序程序部分没有显示error但在运行的时候出现如下错误

2023-02-07 13:29:33.274  INFO 11108 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1220 ms
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2023-02-07 13:29:33.402  INFO 11108 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-02-07 13:29:33.451  INFO 11108 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.14.Final
2023-02-07 13:29:33.640  INFO 11108 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2023-02-07 13:29:33.733  INFO 11108 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2023-02-07 13:29:33.735  WARN 11108 --- [  restartedMain] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2023-02-07 13:29:35.350 ERROR 11108 --- [  restartedMain] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.


以及

2023-02-07 13:29:35.352 ERROR 11108 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2023-02-07 13:29:35.354  WARN 11108 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2023-02-07 13:29:35.358  INFO 11108 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-02-07 13:29:35.369  INFO 11108 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-02-07 13:29:35.392 ERROR 11108 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed



我这里好像上传不了图片,两张截图在下面链接:
https://imgloc.com/i/rM12P
https://imgloc.com/i/rMTuC

  • 写回答

4条回答 默认 最新

  • pzzhao 2023-02-07 22:41
    关注

    报错是未知的数据库,看下数据库名是不是写错了。
    另外最好能贴一下你关于数据库那块的配置。看着好像驱动类也过时了,应该替换成"com.mysql.cj.jdbc.Driver"

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 2月16日
  • 已采纳回答 2月8日
  • 创建了问题 2月7日

悬赏问题

  • ¥15 求全国交通咨询模拟代码,要求如下,可以完全在dev c++运行
  • ¥15 根据要求修改程序编码
  • ¥15 用 Python 做一个用 Excel 表导入的答题系统
  • ¥15 使用微信开发者工具实现一个“婚博会”小程序
  • ¥15 ros的rviz仿真机器人
  • ¥15 关于#linux#的问题(输入输出错误):出现这个界面接着我重新装系统,又让修电脑的师傅帮我扫描硬盘(没有问题)用着用着又卡死(相关搜索:固态硬盘)
  • ¥15 cv::resize不同线程时间不同
  • ¥15 web课程,怎么做啊😭没好好听课 根本不知道怎么下手
  • ¥15 做一个关于单片机的比较难的代码,然后搞一个PPT进行解释
  • ¥15 python提取.csv文件中的链接会经常出现爬取失败