首页 > 解决方案 > 在收到对等方的 close_notify 之前关闭入站

问题描述

我的 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。在我的 PC 上安装了 JDK10,在笔记本电脑上安装了 JDK11?

我不明白为什么会出现这个错误,因为正如我上面所说,这段代码在我的 PC 上运行良好。

标签: javamysqlspringhibernate

解决方案


我遇到了同样的错误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是我的本地主机数据库

希望它可以帮助你!


推荐阅读