【问题标题】:Spring Boot in Docker throwing an exception 'hibernate.dialect' not setDocker中的Spring Boot抛出异常'hibernate.dialect'未设置
【发布时间】:2016-03-30 17:36:22
【问题描述】:

我正在使用spring boot开发一个应用程序,我使用mysql作为数据库。我在application.properties中有以下配置。

server.port=8090
spring.datasource.url=jdbc:mysql://mysql:3306/sampleDB
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.show_sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.temp.use_jdbc_metadata_defaults=false
logging.file=employee.log
spring.datasource.testOnBorrow=true
spring.datasource.validationQuery=SELECT 1

我在我的本地有相应的数据库,它在我的本地工作。但是,一旦我创建了一个 docker 映像并链接到我的 mysql docker 容器,它就会抛出以下异常。

org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

容器甚至连我都看不到。

sudo docker run --name bootApp -d  --link mysql:mysql  springio/employeesecurity

其中 springio/employeesecurity 是我的 springBoot docker 名称,mysql 是我的 msql 容器。

【问题讨论】:

  • 我遇到了同样的错误,问题解决了吗?

标签: hibernate docker spring-boot


【解决方案1】:

可能您的错误是由于无法连接到数据库(在您的堆栈中更深)引起的

您是否尝试过不在连接字符串中指定端口:

spring.datasource.url=jdbc:mysql://mysql:3306/sampleDB

【讨论】:

  • 对我不起作用
猜你喜欢
  • 2020-02-05
  • 2016-09-26
  • 2019-09-19
  • 1970-01-01
  • 1970-01-01
  • 2023-01-10
  • 2020-06-02
  • 2019-01-24
  • 2018-12-30
相关资源
最近更新 更多