Notice
Recent Posts
Recent Comments
Link
반응형
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Archives
Today
Total
관리 메뉴

To Be Develop

[Spring Boot] Caused by: org.hibernate.service.spi.ServiceException: 본문

dev/SpringBoot

[Spring Boot] Caused by: org.hibernate.service.spi.ServiceException:

To Be Develop 2024. 2. 11. 12:56
반응형

Error Message:

Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: Unable to determine Dialect without JDBC metadata (please set 'jakarta.persistence.jdbc.url' for common cases or 'hibernate.dialect' when a custom Dialect implementation must be provided)

---

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: Unable to determine Dialect without JDBC metadata (please set 'jakarta.persistence.jdbc.url' for common cases or 'hibernate.dialect' when a custom Dialect implementation must be provided)

---

java.sql.SQLException: Access denied for user 'springuser'@'localhost' (using password: YES)

WARN 5189 --- [           main] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain connection to query metadata
java.lang.NullPointerException: Cannot invoke 

"org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(java.sql.SQLException, String)" because the return value of 

"org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.sqlExceptionHelper()" is null

Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: Unable to determine Dialect without JDBC metadata (please set 'jakarta.persistence.jdbc.url' for common cases or 'hibernate.dialect' when a custom Dialect implementation must be provided)

Caused by: org.hibernate.HibernateException: Unable to determine Dialect without JDBC metadata (please set 'jakarta.persistence.jdbc.url' for common cases or 'hibernate.dialect' when a custom Dialect implementation must be provided)

---

 

위 에러 메시지는 spring boot 에서 mysql 을 연동할 때 발생한 것으로, 각각 다른 컴퓨터에서 연동할 때 발생한 문제점이다. 각각의 컴퓨터는 mysql 세팅이 달랐기 때문에 사용자 이름, 비밀번호, db 생성 등 몇 가지 수정을 해주어 해결하였다.

 

  1. 사용할 db 를 mysql에서 생성해주지 않았다.
  2. user name 과 비밀번호가 달랐다.
create database db_example; -- Creates the new database
create user 'springuser'@'%' identified by 'ThePassword'; -- Creates the user

grant all on db_example.* to 'springuser'@'%'; -- Gives all privileges to the new user on the newly created database

 

https://spring.io/guides/gs/accessing-data-mysql#scratch

 

Getting Started | Accessing data with MySQL

When you are on a production environment, you may be exposed to SQL injection attacks. A hacker may inject DROP TABLE or any other destructive SQL commands. So, as a security practice, you should make some changes to your database before you expose the app

spring.io

 

반응형