如果您对我无法在Ubuntu服务器上发送电子邮件[javax.net.ssl.SSLHandshakeException]感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于我无
如果您对我无法在 Ubuntu 服务器上发送电子邮件 [javax.net.ssl.SSLHandshakeException]感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于我无法在 Ubuntu 服务器上发送电子邮件 [javax.net.ssl.SSLHandshakeException]的详细内容,我们还将为您解答ubuntu无法创建符号链接的相关问题,并且为您提供关于3、javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake 错误、Android 11的javax.net.ssl.SSLHandshakeException、java 使用post或者get请求出现 javax.net.ssl.SSLHandshakeException、javapns 推送IOS报javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake的有价值信息。
本文目录一览:- 我无法在 Ubuntu 服务器上发送电子邮件 [javax.net.ssl.SSLHandshakeException](ubuntu无法创建符号链接)
- 3、javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake 错误
- Android 11的javax.net.ssl.SSLHandshakeException
- java 使用post或者get请求出现 javax.net.ssl.SSLHandshakeException
- javapns 推送IOS报javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
我无法在 Ubuntu 服务器上发送电子邮件 [javax.net.ssl.SSLHandshakeException](ubuntu无法创建符号链接)
如何解决我无法在 Ubuntu 服务器上发送电子邮件 [javax.net.ssl.SSLHandshakeException]?
我突然无法在 Unbuntu 服务器上发送电子邮件。
从今天起就发生了。 它仍在本地运行。
javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1907)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:666)
JAVA:
openjdk 版本“11.0.11” 2021-04-20
OpenJDK 运行时环境(构建 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM(build 11.0.11+9-Ubuntu-0ubuntu2.20.04,混合模式,共享)
握手后新会话门票已到:
SSL 会话:
协议:TLSv1.3
密码:TLS_AES_256_GCM_SHA384
对不起我的英语。 但是有人可以帮我吗?
解决方法
您的服务器似乎使用 TLSv1.1 或更早版本,并且您最近将 Java 升级到了 11.0.11 版。默认情况下,此版本的 Java 已禁用 TLSv1.0 和 TLSv1.1,例如参见 Oracle Java 11.0.11 release notes(尽管 AFAIK 这适用于所有 OpenJDK 派生版本):
安全库/javax.net.ssl
➜ 禁用 TLS 1.0 和 1.1
TLS 1.0 和 1.1 是 TLS 协议的版本,不再是 被认为是安全的,并已被更安全和现代的 版本(TLS 1.2 和 1.3)。
这些版本现已默认禁用。如果你遇到
问题,您可以自行承担风险,通过删除重新启用这些版本
jdk.tls.disabledAlgorithms
中的“TLSv1”和/或“TLSv1.1”
java.security
配置文件中的安全属性。
我建议您尝试从 TLSv1.1
文件的 jdk.tls.disabledAlgorithms
属性中删除 java.security
是否可以解决您的问题,如果失败,请尝试删除 TLSv1
。这表明您的邮件服务器需要更新或配置以支持更新和更安全的 TLS 版本。
如果你有 ubuntu 操作系统,那么去
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security
然后找到jdk.tls.disabledAlgorithms
然后删除TLSv1,TLSv1.1
重启服务器并再次尝试发送邮件。
3、javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake 错误
使用Jmeter做测试的时候,出现 javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
错误,解决方式是修改java安装路径的文件: G:\Java\jre1.8.0_201\lib\security\java.security
。把注释的 crypto.policy=unlimited
放开。
参考文档: https://blog.csdn.net/kevin_mails/article/details/82143490
http://xwiz.cn/2018-05-09-java-ssl-ciphersuite
Android 11的javax.net.ssl.SSLHandshakeException
如何解决Android 11的javax.net.ssl.SSLHandshakeException?
尝试在Android 11上使用HTTPS连接到我的服务器时,我的应用程序抛出javax.net.ssl.SSLHandshakeException错误。
可能是什么原因造成的?我正在通过CloudFlare使用完全SSL。 Android 11是否需要完整的SSL(严格)?
2020-09-12 19:21:37.131 20726-20857/? I/APP: I 09/12/2020 19:21:37:130 b7ef51e0 Net| POST request (Pull): sync.mydomain.com/rc/v1/app/login
2020-09-12 19:21:37.146 206-212/? E/android.system.suspend@1.0-service: Error opening kernel wakelock stats for: wakeup34: Permission denied
2020-09-12 19:21:37.149 206-212/? E/android.system.suspend@1.0-service: Error opening kernel wakelock stats for: wakeup35: Permission denied
2020-09-12 19:21:37.143 206-206/? W/Binder:206_2: type=1400 audit(0.0:3377): avc: denied { read } for name="wakeup34" dev="sysfs" ino=18474 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0
2020-09-12 19:21:37.147 206-206/? W/Binder:206_2: type=1400 audit(0.0:3378): avc: denied { read } for name="wakeup35" dev="sysfs" ino=18534 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0
2020-09-12 19:21:37.192 20726-20857/? I/APP: I 09/12/2020 19:21:37:192 b7ef51e0 SSLImplJava| SSL connect to sync.mydomain.com:443
2020-09-12 19:21:37.192 20726-20857/? I/APP: I 09/12/2020 19:21:37:192 b7ef51e0 SSLImplJava| Creating secure SSL factory
2020-09-12 19:21:37.193 20726-20857/? I/APP: I 09/12/2020 19:21:37:193 b7ef51e0 SSLImplJava| Creating TrustManager for system certificates
2020-09-12 19:21:37.193 20726-20857/? I/APP: I 09/12/2020 19:21:37:193 b7ef51e0 SSLImplJava| Loading all SSL certificates from config
2020-09-12 19:21:37.193 20726-20857/? I/APP: I 09/12/2020 19:21:37:193 b7ef51e0 SSLImplJava| SSL certificates loaded: 0
2020-09-12 19:21:37.193 20726-20857/? I/APP: I 09/12/2020 19:21:37:193 b7ef51e0 SSLImplJava| Creating TrustManager for custom certificates
2020-09-12 19:21:37.193 20726-20857/? I/APP: I 09/12/2020 19:21:37:193 b7ef51e0 SSLImplJava| clientSSLCertificate is
2020-09-12 19:21:37.195 20726-20857/? I/APP: I 09/12/2020 19:21:37:195 b7ef51e0 SSLImplJava| Secure SSL factory initialization completed
2020-09-12 19:21:37.196 20726-20857/? I/APP: E 09/12/2020 19:21:37:196 b7ef51e0 SSLImplJava| Call of "connect" Failed: SSLHandshakeException: Attempt to invoke virtual method ''void java.io.OutputStream.write(byte[],int,int)'' on a null object reference
2020-09-12 19:21:37.197 20726-20857/? W/System.err: javax.net.ssl.SSLHandshakeException: Attempt to invoke virtual method ''void java.io.OutputStream.write(byte[],int)'' on a null object reference
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:362)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.android.org.conscrypt.ConscryptEnginesocket.doHandshake(ConscryptEnginesocket.java:276)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.android.org.conscrypt.ConscryptEnginesocket.startHandshake(ConscryptEnginesocket.java:217)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.android.org.conscrypt.ConscryptEnginesocket.waitForHandshake(ConscryptEnginesocket.java:563)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.android.org.conscrypt.ConscryptEnginesocket.getoutputStream(ConscryptEnginesocket.java:298)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.rhomobile.rhodes.socket.SSLImpl.connect(SSLImpl.java:639)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ''void java.io.OutputStream.write(byte[],int)'' on a null object reference
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.android.org.conscrypt.ConscryptEnginesocket$SSLOutputStream.writetoSocket(ConscryptEnginesocket.java:715)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.android.org.conscrypt.ConscryptEnginesocket$SSLOutputStream.writeInternal(ConscryptEnginesocket.java:689)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.android.org.conscrypt.ConscryptEnginesocket$SSLOutputStream.access$200(ConscryptEnginesocket.java:616)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: at com.android.org.conscrypt.ConscryptEnginesocket.doHandshake(ConscryptEnginesocket.java:245)
2020-09-12 19:21:37.197 20726-20857/? W/System.err: ... 4 more
2020-09-12 19:21:37.197 20726-20857/? I/APP: E 09/12/2020 19:21:37:197 b7ef51e0 Net| Operation finished with error 35: SSL connect error
2020-09-12 19:21:37.197 20726-20857/? I/APP: E 09/12/2020 19:21:37:197 b7ef51e0 Net| CURLNetRequest: METHOD = [POST] URL = [https://sync.mydomain.com/rc/v1/app/login] BODY = [{"login":"","password":"","remember_me":1}]
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
java 使用post或者get请求出现 javax.net.ssl.SSLHandshakeException
问题描述:使用Java HttpClient 请求https接口时本地环境没有,但是部署到Linux服务器上出现报错
报错内容
open-jdk版本是1.8.0_301
在调用https接口时,出现以下错误
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at sun.security.ssl.Handshaker.activate(Handshaker.java:529)
at sun.security.ssl.SSLSocketImpl.kickstartHandshake(SSLSocketImpl.java:1492)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1361)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
解决办法
以下提供两种解决办法
1、修改jdk配置文件
解决办法:找到jdk 1.8安装目录,
找到 安装目录 里面的lib\security 下面有个java.security。
**找到对应的SSLv3,TLSv1, TLSv1.1, 注释掉,重启项目就好了**
linux查找jdk安装目录:
which java
ls -lrt /usr/bin/java
ls -lrt /etc/alternatives/java
2、修改HttpClient 发包器
import org.apache.http.httpentity;
import org.apache.http.ParseException;
import org.apache.http.client.methods.*;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import javax.net.ssl.SSLContext;
import java.io.IOException;
import java.net.URI;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
/**
* @author: dwl
* @create: 2021-06-07 10:33
**/
public class HTTPClientImpl {
final String HTTPS = "https";
final String HTTP = "http";
CloseableHttpClient httpClient;
HTTPClientData httpClientData = new HTTPClientData();
/**
* 无参构造方法,创建并初始化httpClient
*/
public HTTPClientImpl(){
TrustStrategy acceptingTrustStrategy = (cert, authType) -> true;
SSLContext sslContext = null;
try {
sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build();
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
e.printstacktrace();
}
assert sslContext != null;
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext,
NoopHostnameVerifier.INSTANCE);
Registry<ConnectionSocketFactory> socketFactoryRegistry =
RegistryBuilder.<ConnectionSocketFactory> create()
.register(HTTPS, sslsf)
.register(HTTP, new PlainConnectionSocketFactory())
.build();
BasicHttpClientConnectionManager connectionManager =
new BasicHttpClientConnectionManager(socketFactoryRegistry);
// 获得Http客户端(可以理解为:你得先有一个浏览器;注意:实际上HttpClient与浏览器是不一样的)
httpClient = HttpClientBuilder.create().setSSLSocketFactory(sslsf).setConnectionManager(connectionManager).build();
}
/**
* GET请求目标URI
* @param uri 目标URI
*/
public HTTPClientData doGet(URI uri){
// 创建Get请求
HttpGet httpGet = new HttpGet(uri);
sendRequest(httpGet);
return httpClientData;
}
public HTTPClientData doPostJSON(URI uri, String jsonString){
// 创建Post请求
HttpPost httpPost = new HttpPost(uri);
StringEntity entity = new StringEntity(jsonString, "UTF-8");
// post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中
httpPost.setEntity(entity);
sendRequest(httpPost);
return httpClientData;
}
public HTTPClientData doDelete(URI uri){
// 创建Delete请求
HttpDelete httpDelete = new HttpDelete(uri);
sendRequest(httpDelete);
return httpClientData;
}
public void sendRequest(HttpRequestBase httpRequest){
// 响应模型
CloseableHttpResponse response = null;
try {
// 由客户端执行(发送)Get请求
response = httpClient.execute(httpRequest);
// 从响应模型中获取响应实体
httpentity responseEntity = response.getEntity();
httpClientData.setAllHeaders(response.getAllHeaders());
httpClientData.setStatus(response.getStatusLine());
// System.out.println("响应包头为:" + Arrays.toString(response.getAllHeaders()));
// System.out.println("响应状态为:" + response.getStatusLine());
if (responseEntity != null) {
httpClientData.setContent(EntityUtils.toString(responseEntity));
httpClientData.setContentLength(responseEntity.getContentLength());
httpClientData.setContentEncoding(responseEntity.getContentEncoding());
httpClientData.setContentType(responseEntity.getContentType());
// System.out.println("响应内容长度为:" + responseEntity.getContentLength());
// System.out.println("响应内容为:" + EntityUtils.toString(responseEntity));
}
} catch (ParseException | IOException e) {
e.printstacktrace();
} finally {
try {
// 释放资源
if (httpClient != null) {
httpClient.close();
}
if (response != null) {
response.close();
}
} catch (IOException e) {
e.printstacktrace();
}
}
}
}
import org.apache.http.Header;
import org.apache.http.StatusLine;
import java.util.Arrays;
/**
* @author: dwl
* @create: 2021-06-16 13:17
**/
public class HTTPClientData {
Header[] AllHeaders;
StatusLine Status;
long ContentLength;
Header ContentEncoding;
Header ContentType;
String Content;
public Header[] getAllHeaders() {
return AllHeaders;
}
@Override
public String toString() {
return "HTTPClientData{" +
"AllHeaders=" + Arrays.toString(AllHeaders) +
", Content='" + Content + '\'' +
'}';
}
public void setAllHeaders(Header[] allHeaders) {
AllHeaders = allHeaders;
}
public StatusLine getStatus() {
return Status;
}
public void setStatus(StatusLine status) {
Status = status;
}
public long getContentLength() {
return ContentLength;
}
public void setContentLength(long contentLength) {
ContentLength = contentLength;
}
public Header getContentEncoding() {
return ContentEncoding;
}
public void setContentEncoding(Header contentEncoding) {
ContentEncoding = contentEncoding;
}
public Header getContentType() {
return ContentType;
}
public void setContentType(Header contentType) {
ContentType = contentType;
}
public String getContent() {
return Content;
}
public void setContent(String content) {
Content = content;
}
}
javapns 推送IOS报javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
使用javapns推送IOS报SSL连接失败,是因为苹果那边禁用了SSL吗
如果禁用了 要用什么办法推送
今天关于我无法在 Ubuntu 服务器上发送电子邮件 [javax.net.ssl.SSLHandshakeException]和ubuntu无法创建符号链接的讲解已经结束,谢谢您的阅读,如果想了解更多关于3、javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake 错误、Android 11的javax.net.ssl.SSLHandshakeException、java 使用post或者get请求出现 javax.net.ssl.SSLHandshakeException、javapns 推送IOS报javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake的相关知识,请在本站搜索。
本文标签: