Java报错javax.net.ssl.SSLException MESSAGE: closing inbound before receiving peer‘s close_notify解决方法

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: Java报错javax.net.ssl.SSLException MESSAGE: closing inbound before receiving peer‘s close_notify解决方法

一、问题描述


在利用SpringBoot开发项目时发现控制台中报了javax.net.ssl.SSLException MESSAGE: closing inbound before receiving peer'sclose_notify的错误,但是并没有影响程序的正常运行,网络上搜索了很多种方法都没有解决了,偶然间看到一篇博客写到了解决的方法并成功解决了报错,在此进行记录。

MonSep1309:48:11CST2021WARN: Caughtwhiledisconnecting...
EXCEPTIONSTACKTRACE:
**BEGINNESTEDEXCEPTION**javax.net.ssl.SSLExceptionMESSAGE: closinginboundbeforereceivingpeer's close_notifySTACKTRACE:
javax.net.ssl.SSLException: closinginboundbeforereceivingpeer's close_notifyatjava.base/sun.security.ssl.Alert.createSSLException(Alert.java:133)
atjava.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
atjava.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:356)
atjava.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:312)
atjava.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:303)
atjava.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:817)
atjava.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:796)
atcom.mysql.cj.protocol.a.NativeProtocol.quit(NativeProtocol.java:1312)
atcom.mysql.cj.NativeSession.quit(NativeSession.java:182)
atcom.mysql.cj.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:1750)
atcom.mysql.cj.jdbc.ConnectionImpl.close(ConnectionImpl.java:720)
atcom.zaxxer.hikari.pool.PoolBase.quietlyCloseConnection(PoolBase.java:143)
atcom.zaxxer.hikari.pool.HikariPool.lambda$closeConnection$1(HikariPool.java:451)
atjava.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
atjava.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
atjava.base/java.lang.Thread.run(Thread.java:832)
**ENDNESTEDEXCEPTION**

二、解决方法


在配置文件中数据库连接的url属性中加入useSSL=false即可解决

yml文件格式:

##数据源配置spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/数据库名称?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=falseusername: 用户名password: 密码

二、解决方法


在配置文件中数据库连接的url属性中加入useSSL=false即可解决

yml文件格式:

##数据源配置spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/数据库名称?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=falseusername: 用户名password: 密码

properties文件格式:

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driverspring.datasource.url=jdbc:mysql://127.0.0.1:3306/数据库名称?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=falsespring.datasource.username=用户名spring.datasource.password=密码

总结


在开发项目的过程中并未直观的感觉到SSL证书连接异常会带来什么样的后果,在查阅资料之后才发现,SSL证书的连接对网站的安全性

有着至关重要的作用,SSL证书是一种安全性高的数字证书,该证书配置在服务器上之后,能够更好的提高网站的安全性,给网站更好的安全防护。

如果SSL证书连接异常,将会带来以下的后果:(以下内容转自一位大佬的博客,仅供个人学习使用)

  1. 网站安全性下降:企业给网站配置SSL证书的目的就是保护网站安全,提高网站的安全性。但是一旦SSL证书连接异常,将无法起到保护网站的所用,这种情况下网站的安全性就会大大的下降。
  2. 信息会发生泄露:如果网站配置了SSL证书,就可以让信息加密传输,可以防止信息泄露出去。然而当SSL证书发生连接异常后,对传输的信息将起不到加密作用,这种情况下,客户端和服务器之间的信息传输就更容易被泄露出去。

以上便是javax.net.ssl.SSLException MESSAGE: closing inbound before receiving peer's close_notify错误的解决方法以及SSL证书连接异常时会带来的影响

image.png

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
16天前
|
Java C# 开发者
【干货】Java开发者快速上手.NET指南
【干货】Java开发者快速上手.NET指南
|
26天前
启动报错:java.nio.charset.MalformedInputException: Input length = 1
启动报错:java.nio.charset.MalformedInputException: Input length = 1
16 0
|
29天前
|
Java 编译器
有关电脑中idea编译报错问题java: No implementation was created for AdminUserConverter due to having a problem in
有关电脑中idea编译报错问题java: No implementation was created for AdminUserConverter due to having a problem in
32 0
|
13天前
|
Java Maven
【Java报错】显示错误“Error:java: 程序包org.springframework.boot不存在“
【Java报错】显示错误“Error:java: 程序包org.springframework.boot不存在“
34 3
|
8天前
|
存储 移动开发 前端开发
对象存储oss使用问题之OSS SDK .net 使用下载例程报错如何解决
《对象存储OSS操作报错合集》精选了用户在使用阿里云对象存储服务(OSS)过程中出现的各种常见及疑难报错情况,包括但不限于权限问题、上传下载异常、Bucket配置错误、网络连接问题、跨域资源共享(CORS)设定错误、数据一致性问题以及API调用失败等场景。为用户降低故障排查时间,确保OSS服务的稳定运行与高效利用。
23 0
|
12天前
|
Java 应用服务中间件 Maven
使用IDEA搭建SpringMVC环境,Maven导入了依赖,但是运行报错 java.lang.ClassNotFoundException
使用IDEA搭建SpringMVC环境,Maven导入了依赖,但是运行报错 java.lang.ClassNotFoundException
11 1
|
16天前
|
存储 Java 数据库连接
java使用mp持久化框架,写入5000个字符,但是VARCHAR(255) 会报错
使用Java的MyBatis Plus框架时,如果尝试将超过VARCHAR(255)限制的字符串(如5000个字符)存入数据库,会抛出异常。解决方法是将列类型改为TEXT。可通过在实体类属性上添加`@TableField(typeHandler = JdbcType.CLOB)`注解,如`private String content;`,将属性映射到CLOB类型列,以存储更长字符串。
9 0
|
1月前
|
Java 关系型数据库 MySQL
Flink1.18.1和CDC2.4.1 本地没问题 提交任务到服务器 报错java.lang.NoClassDefFoundError: Could not initialize class io.debezium.connector.mysql.MySqlConnectorConfig
【2月更文挑战第33天】Flink1.18.1和CDC2.4.1 本地没问题 提交任务到服务器 报错java.lang.NoClassDefFoundError: Could not initialize class io.debezium.connector.mysql.MySqlConnectorConfig
50 2
|
1月前
|
XML Java 数据库连接
mybatis报错:java.lang.IllegalArgumentException: Mapped Statements collection does not contain
mybatis报错:java.lang.IllegalArgumentException: Mapped Statements collection does not contain
13 0
|
1月前
|
网络安全
ssh报错java.lang.ClassCastException: com.sun.proxy.$Proxy6 cannot be cast to org.service.impl.EmpServi
ssh报错java.lang.ClassCastException: com.sun.proxy.$Proxy6 cannot be cast to org.service.impl.EmpServi
10 1