Unrecognized SSL message, plaintext connection? an exception

I have a java compatible package for communicating with an https server on the network. Running compilation gives the following exception:

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) 

I think this is due to the fact that the connection established with the client machine is not secure. Is there a way to configure the local computer or ports to connect to a remote https server?

+132
java
Jun 30
source share
18 answers

I think this is due to the connection installed with the client machine is not protected.

This is because you are talking to an HTTP server, not an HTTPS server. You may not have used the correct port number for HTTPS.

+191
Jun 30 '11 at 11:00
source share
 javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? 

You must have a local SMTP domain name that will contact the mail server and establish a new connection, and you must also change the SSL property in your programming below

 javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection props.put("mail.smtp.socketFactory.fallback", "true"); // Should be true 
+16
Mar 19 '13 at 10:03
source share

I received the same error message when I forgot to enter the company’s firewall before performing a POST request through a proxy.

+8
Apr 09 '13 at 12:01
source share

I got the same error. this is because I accessed the https port using http. The problem was resolved when I changed http to https.

+3
Feb 03 '14 at 6:34
source share

I am facing the same issue with a Java application built into the Jdevelopr 11.1.1.7 IDE. I solved the problem by unchecking the use of proxy project properties.

You can find it in the following: Project Properties → (from the left panel) Start / Debug / Profile → Click (change) from the right panel → Tool Settings from the left panel → uncheck (Use proxy).

+1
Aug 10 '14 at 14:23
source share

Adding this as an answer as this may help someone later.

I had to force jvm to use the IPv4 stack to fix the error. My application was used to work on the company’s network, but when connected from home it gave the same exception. No proxy. Added jvm argument -Djava.net.preferIPv4Stack=true and all https requests behave normally.

+1
Feb 06 '17 at 20:47
source share

As EJP said, this message is shown due to a call to the non-https protocol. If you are sure that it is HTTPS, check the crawl proxy settings and in case your webservice host URL is in the crawl proxy list

0
Sep 07 '15 at 17:02
source share

if the connection is FTPS test:

FTPSClient ftpClient = new FTPSClient (protocol, false);

protocol = TLS, SSL and false = isImplicit.

0
Mar 22 '17 at 17:57
source share

I came across this exception when using Gmail.

To use Gmail, I had to enable "Allow less secure applications . "

This Gmail setting can be found at https://www.google.com/settings/security/lesssecureapps after logging in to your Gmail account.

0
Mar 23 '18 at 21:29
source share

I have a similar error when using the camel email component to send emails via gmail smtp.

The solution changed from TLS port (587) to SSL port (465), as shown 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&amp;password=mypw&amp;to=someemail@gmail.com&amp;debugMode=true&amp;mail.smtp.starttls.enable=true"/> </route> 
0
Jan 15 '19 at 1:09
source share

If you work locally with Spring, I would suggest using:

 @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(); } 

This works for me with a unit test.

Hope this helps!

0
Jun 05 '19 at 10:08
source share

Now it worked for me, I changed the setting of my google account, as shown below:

  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); } 

Although I turned on SSL and TSL while starting the program in this link of the same message. I spend a lot of time, but I understood and found this link. And they took the next 2 steps and established control in google .:

  • Disable 2-step verification (password and OTP)

  • Enabling access to a less secure application ( Allow less secure applications: ON. )

Now I can send mail using the above program.

-one
07 Feb '16 at 7:45
source share

If you work

  • Cisco AnyConnect Secure Mobility Agent
  • Cisco AnyConnect Web Security Agent

try stopping the service (s).

Not sure why I got a negative vote for this answer. In our corporate network, this is a solution to the problem.

-one
Feb 20 '18 at 7:52
source share

I got the same problem and it was solved by setting "proxyUser" and "proxyPassword" in the 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 this works.

-one
Mar 06 '18 at 7:38
source share

I solved my problem using port 25 and the next prop

 mailSender.javaMailProperties.putAll([ "mail.smtp.auth": "true", "mail.smtp.starttls.enable": "false", "mail.smtp.ssl.enable": "false", "mail.smtp.socketFactory.fallback": "true", ]); 
-one
Mar 27 '18 at 10:52
source share

If you start the Java process from the command line in Java 6 or earlier, adding this switch solved the problem above for me:

-Dhttps.protocols = "TLSv1"

-2
Aug 18 '15 at 15:05
source share

Your certificate may have expired by default. update it through the Security administrator’s console SSL certificate and key management> Key stores and certificates> NodeDefaultKeyStore> Personal certificates "select the default alias and click" update "after restarting WAS.

-3
Jul 10 '14 at 8:44
source share

Another reason, perhaps, is “access denied”, perhaps you cannot access the URI and get the lock response page for internal network access. If you are not sure that your application requires a firewall rule, you are trying to connect to the terminal, the command line. For GNU / Linux or Unix, you can try running this command and see that the result comes from a blocking rule or a really remote address: echo | nc -v yazilimcity.net 443 echo | nc -v yazilimcity.net 443

-3
May 9 '17 at 12:20
source share



All Articles