我在PC上有一个正常工作的项目(Spring + Mysql + Hibernate),但是随后我在笔记本电脑中使用相同的设置复制了该项目,但该项目无法正常工作,并且 抛出了此异常 ->
** BEGIN NESTED EXCEPTION **
javax.net.ssl.SSLException
MESSAGE: closing inbound before receiving peer's close_notify
STACKTRACE:
javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:129)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:255)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:645)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:624)
at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:2249)
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4232)
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1472)
at com.zaxxer.hikari.pool.PoolBase.quietlyCloseConnection(PoolBase.java:132)
at com.zaxxer.hikari.pool.HikariPool.lambda$closeConnection$1(HikariPool.java:434)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
** END NESTED EXCEPTION **
还要扔掉->
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 javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
这是我的application.properties,我在其中连接到数据库
# ===============================
# = DATA SOURCE
# ===============================
# Set here configurations for the database connection
spring.datasource.url=jdbc:mysql://localhost:3306/shop_v3
spring.datasource.username=root
spring.datasource.password=12345
#spring.datasource.password=YOUR_DB_PASSWORD
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
# ===============================
# = JPA / HIBERNATE
# ===============================
# Show or not log for each sql query
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create-drop
# Hibernate ddl auto (create, create-drop, update): with "create-drop" the database
# schema will be automatically created afresh for every start of application
# Naming strategy
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
# Allows Hibernate to generate SQL optimized for a particular DBMS
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
也许是因为我使用了不同版本的JDK。在安装了JDK10的PC上,还是在笔记本JDK11上?
我不明白为什么会出现此错误,因为如上所述,此代码在我的PС上正常工作。
答案 0 :(得分:2)
我和你有同样的错误,javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify
,我使用 connectotor / J 8.0 ,却遇到了这个错误,所以我尝试更改为 connectotor / J 5 ,我遇到了另一个错误,但是该错误告诉我将 ssl连接器设置为false ,我这样做了,问题就解决了。
db_url =“ jdbc:mysql:// localhost:3306 / stu?useSSL = false ”,
stu 是我的本地主机数据库
希望它能为您提供帮助!
答案 1 :(得分:0)
我解决了身份证!我错误地将项目导入了想法