我的项目使用Spring Boot和Hibernate,我的数据库是MySql。我使用的是注释而不是JPA。当我调用Rest api时,我得到的响应如下:
白标签错误页面
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue May 17 11:32:13 CEST 2016
There was an unexpected error (type=Internal Server Error, status=500).
Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.TransactionException: JDBC begin transaction failed:
这是我的应用程序属性
spring.datasource.url=jdbc:mysql://x.x.x.x:3306/db_myfme?useUnicode=yes&characterEncoding=UTF-8&characterSetResults=UTF-8
spring.datasource.username=username
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.properties.hibernate.connection.characterEncoding=utf-8
spring.jpa.properties.hibernate.connection.CharSet=utf-8
spring.jpa.properties.hibernate.connection.useUnicode=true
server.tomcat.uri-encoding=UTF-8
# HTTP encoding (HttpEncodingProperties)
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
spring.mail.host=smtp.gmail.com
spring.mail.username= capfme@gmail.com
spring.mail.password= *******
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.smtp.socketFactory.port=587
spring.mail.properties.mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.smtp.ssl.enable = true
spring.mail.properties.mail.smtp.socketFactory.fallback = false
spring.datasource.testOnBorrow: true
spring.datasource.validationQuery: SELECT 1
spring.jpa.hibernate.ddl-auto=none