エラーページ文
There was an unexpected error (type=Internal Server Error, status=500).
Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
console
2019-07-16 14:44:11.864 INFO 11500 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2019-07-16 14:44:11.911 INFO 11500 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.10.Final} 2019-07-16 14:44:11.911 INFO 11500 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2019-07-16 14:44:12.004 INFO 11500 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final} 2019-07-16 14:44:12.083 INFO 11500 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2019-07-16 14:44:12.083 WARN 11500 --- [ main] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. 2019-07-16 14:44:13.114 ERROR 11500 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
application properties
spring.jpa.hibernate.ddl-auto=none spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect spring.datasource.url=jdbc:mysql://localhost:3306/db_sample spring.datasource.username=??? spring.datasource.password=??? spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.type=com.zaxxer.hikari.HikariDataSource
pom.xml
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency>
環境
windows10
sts-4.3.0
java-12
ご教授お願いします。
追記
package com.example.demo; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class MainController { @Autowired private tblRepository tblRe; @RequestMapping(value = "/test1") public List<tbl_sample> get() { return tblRe.findAll(); } }
package com.example.demo; import org.springframework.data.jpa.repository.JpaRepository; public interface tblRepository extends JpaRepository<tbl_sample,String> { }
package com.example.demo; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="tbl_name") public class tbl_sample { @Id private String id; private String kokugo; private String eigo; public String getId(){ return id; } public String getKokugo() { return kokugo; } public String getEigo() { return eigo; } }
回答2件
あなたの回答
tips
プレビュー