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

使用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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵