{"id":558,"date":"2022-07-28T22:32:02","date_gmt":"2022-07-29T03:32:02","guid":{"rendered":"https:\/\/muthii.com\/blog\/?p=558"},"modified":"2022-07-28T22:32:02","modified_gmt":"2022-07-29T03:32:02","slug":"no-appropriate-protocol","status":"publish","type":"post","link":"https:\/\/muthii.com\/blog\/?p=558","title":{"rendered":"No appropriate protocol"},"content":{"rendered":"\n<p>I saw this error message once I updated to JDK 11 when trying to send emails initially I didn&#8217;t have time to figure out a long term solution so I took a shortcut and removed Tls 1.0 from blocked algorithms in the java.security file. (I know that was a bad move but I was on a time crunch so I wasn&#8217;t thinking clearly \ud83d\ude42 )<br>Things were ok for a while until an update of JDK replaced my update to java.security file, at this point I figured I would have to keep repeating this dance every few months or get a long term solution.<\/p>\n\n\n\n<p> I use apache commons library to send email and by default it uses &lt; TLS v1.2  and JDK 11+ supports > TLS v1.2. The permanent fix just turned out to be specifying TLS version to be used and my app was able to get back to sending emails without any issues and this time it was future proofed from future update breakage due to JDK updates. Below are the parmeter updates needed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Method 1 adding a system property\nSystem.setProperty(\"mail.smtp.ssl.protocols\", \"TLSv1.2\");\nSystem.setProperty(\"mail.pop3s.ssl.protocols\", \"TLSv1.2\");<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#Method 2 setting value in a property file\nspring.mail.properties.mail.smtp.ssl.protocols=TLSv1.2\nspring.mail.properties.mail.pop3s.ssl.protocols=TLSv1.2<\/code><\/pre>\n\n\n\n<p>I went with Method #2 as it allows easier management of properties but every bodies use case is different so you can go with whatever works for your situation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I saw this error message once I updated to JDK 11 when trying to send emails initially I didn&#8217;t have time to figure out a long term solution so I took a shortcut and removed Tls 1.0 from blocked algorithms in the java.security file. (I know that was a bad move but I was on &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/muthii.com\/blog\/?p=558\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;No appropriate protocol&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[124,46],"tags":[152],"_links":{"self":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/558"}],"collection":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=558"}],"version-history":[{"count":2,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/558\/revisions"}],"predecessor-version":[{"id":561,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/558\/revisions\/561"}],"wp:attachment":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}