인식 할 수없는 SSL 메시지, 일반 텍스트 연결? 예외
net에서 https 서버와 통신하기 위해 Java 호환 패키지가 있습니다. 컴파일을 실행하면 다음 예외가 발생합니다.
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
클라이언트 컴퓨터와의 연결이 안전하지 않기 때문입니다. 원격 https 서버에 연결하기 위해 로컬 시스템을 구성 할 수있는 방법이 있습니까?
클라이언트 컴퓨터와의 연결이 안전하지 않기 때문입니다.
HTTPS 서버가 아닌 HTTP 서버와 통신하고 있기 때문입니다. 아마도 HTTPS에 올바른 포트 번호를 사용하지 않았을 것입니다.
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
메일 서버에 접속하고 새 연결을 설정하는 로컬 SMTP 도메인 이름이 있어야하며 아래 프로그래밍에서 SSL 특성을 변경해야합니다.
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection
props.put("mail.smtp.socketFactory.fallback", "true"); // Should be true
프록시를 통해 POST 요청을 수행하기 전에 회사 방화벽에 로그인하는 것을 잊었을 때 동일한 오류 메시지가 나타납니다.
같은 오류가 발생했습니다. http를 사용하여 https 포트에 액세스했기 때문입니다. http를 https로 변경하면 문제가 해결되었습니다.
Jdevelopr 11.1.1.7 IDE에 내장 된 Java 응용 프로그램에서 동일한 문제가 발생합니다. 프록시 양식 프로젝트 속성 사용을 선택 취소하여 문제를 해결했습니다.
다음에서 찾을 수 있습니다 : 프로젝트 속성-> (왼쪽 창에서) 실행 / 디버그 / 프로필-> 오른쪽 패널에서 클릭 (편집)-> 왼쪽 패널에서 도구 설정-> (프록시 사용) 옵션을 선택 취소하십시오.
나중에 누군가에게 도움이 될 수 있으므로 이것을 답변으로 추가하십시오.
jvm이 IPv4 스택을 사용하여 오류를 해결하도록 강요했습니다. 내 응용 프로그램은 회사 네트워크 내에서 작동했지만 집에서 연결하는 동안 동일한 예외가 발생했습니다. 프록시가 필요하지 않습니다. jvm 인수를 추가했으며 -Djava.net.preferIPv4Stack=true
모든 https
요청이 정상적으로 작동했습니다.
스프링을 사용하여 로컬을 실행하는 경우 사용을 제안합니다.
@Bean
public AmazonDynamoDB amazonDynamoDB() throws IOException {
return AmazonDynamoDBClientBuilder.standard()
.withCredentials(
new AWSStaticCredentialsProvider(
new BasicAWSCredentials("fake", "credencial")
)
)
.withClientConfiguration(new ClientConfigurationFactory().getConfig().withProtocol(Protocol.HTTP))
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("localhost:8443", "central"))
.build();
}
단위 테스트를 사용하여 작동합니다.
도움이 되길 바랍니다!
그것은 지금 나를 위해 일했습니다. 아래와 같이 Google 계정 설정을 변경했습니다.
System.out.println("Start");
final String username = "myemail@gmail.com";
final String password = "************";
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "465");
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
try {
Transport transport=session.getTransport();
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("myemail@gmail.com"));//formBean.getString("fromEmail")
message.setRecipients(Message.RecipientType.TO,InternetAddress.parse("myemail@gmail.com"));
message.setSubject("subject");//formBean.getString(
message.setText("mailBody");
transport.connect();
transport.send(message, InternetAddress.parse("myemail@gmail.com"));//(message);
System.out.println("Done");
} catch (MessagingException e) {
System.out.println("e="+e);
e.printStackTrace();
throw new RuntimeException(e);
}
동일한 게시물 의이 링크 에서 프로그램을 실행하는 동안 SSL 및 TSL을 활성화했지만 나는 많은 시간을 소비하지만이 링크를 깨닫고 발견 한 것보다. 그리고 구글에서 2 단계와 설정 제어를 완료했습니다. :
2 단계 인증 비활성화 (암호 및 OTP)
Enabling to allow to access less secure app(Allow less secure apps: ON.)
Now I am able to send mail using above program.
As EJP said, it's a message shown because of a call to a non-https protocol. If you are sure it is HTTPS, check your bypass proxy settings, and in case add your webservice host url to the bypass proxy list
if connection is FTPS test:
FTPSClient ftpClient = new FTPSClient(protocol, false);
protocol = TLS,SSL and false = isImplicit.
I was facing this exception when using Gmail.
In order to use Gmail I had to turn ON "Allow less secure apps".
This Gmail setting can be found at https://www.google.com/settings/security/lesssecureapps after login the gmail account.
I've got similar error using camel-mail component to send e-mails by gmail smtp.
The solution was changing from TLS port (587) to SSL port (465) as below:
<route id="sendMail">
<from uri="jason:toEmail"/>
<convertBodyTo type="java.lang.String"/>
<setHeader headerName="Subject"><constant>Something</constant></setHeader>
<to uri="smtps://smtp.gmail.com:465?username=myemail@gmail.com&password=mypw&to=someemail@gmail.com&debugMode=true&mail.smtp.starttls.enable=true"/>
</route>
I got the same issue and it got resolved by setting "proxyUser" and "proxyPassword" in system properties.
System.setProperty("http.proxyUser", PROXY_USER);
System.setProperty("http.proxyPassword", PROXY_PASSWORD);
along with "proxyHost" and "proxyPort"
System.setProperty("http.proxyHost", PROXY_ADDRESS);
System.setProperty("http.proxyPort", PROXY_PORT);
Hope it will work.
i solved my problem using port 25 and Following prop
mailSender.javaMailProperties.putAll([
"mail.smtp.auth": "true",
"mail.smtp.starttls.enable": "false",
"mail.smtp.ssl.enable": "false",
"mail.smtp.socketFactory.fallback": "true",
]);
In case you are running
- Cisco AnyConnect Secure Mobility Agent
- Cisco AnyConnect Web Security Agent
try stopping the service(s).
Not sure why I got a down vote for this answer. In our corporate network this IS the solution to the issue.
If you're running the Java process from the command line on Java 6 or earlier, adding this switch solved the issue above for me:
-Dhttps.protocols="TLSv1"
Maybe your default cerficate has expired. to renew it through admin console go "Security >SSL certificate and key management > Key stores and certificates > NodeDefaultKeyStore > Personal certificates" select the "default" alias and click on "renew" after then restart WAS.
Another reason is maybe "access denided", maybe you can't access to the URI and received blocking response page for internal network access. If you are not sure your application zone need firewall rule, you try to connect from terminal,command line. For GNU/Linux or Unix, you can try run like this command and see result is coming from blocking rule or really remote address: echo | nc -v yazilimcity.net 443
참고URL : https://stackoverflow.com/questions/6532273/unrecognized-ssl-message-plaintext-connection-exception
'IT' 카테고리의 다른 글
egg_info 오류로 인해 pip를 통해 설치할 수 없습니다 (0) | 2020.06.16 |
---|---|
XML 명령 줄 처리를위한 Grep 및 Sed (0) | 2020.06.16 |
Clojure에서 GUI를 수행하는 가장 좋은 방법은 무엇입니까? (0) | 2020.06.16 |
Java에서 일반 클래스 인스턴스화 (0) | 2020.06.16 |
오라클“(+)”연산자 (0) | 2020.06.16 |