<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>java 1.8 &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/java-1-8/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Fri, 25 Jun 2021 08:54:44 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>java 1.8 &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程</title>
		<link>https://noter.tw/8623/received-fatal-alert-handshake_failure/</link>
					<comments>https://noter.tw/8623/received-fatal-alert-handshake_failure/#comments</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 25 Jun 2021 08:54:43 +0000</pubDate>
				<category><![CDATA[程式開發]]></category>
		<category><![CDATA[一般程式]]></category>
		<category><![CDATA[java ssl error]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[javax.net.ssl.SSLHandshakeException]]></category>
		<category><![CDATA[Received fatal alert: handshake_failure]]></category>
		<category><![CDATA[handshake_failure]]></category>
		<category><![CDATA[java 1.7]]></category>
		<category><![CDATA[java 1.8]]></category>
		<category><![CDATA[jre]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=8623</guid>

					<description><![CDATA[<p>小蛙的工作常常要維護很多有年代的系統，這些系統有些已經找不到源頭或甚至沒有文件留下來了，前一段時間一直碰到抓 https 的時候噴錯的狀況，這篇把這段很痛苦的經歷記錄下來，希望能幫助遇到相同問題的朋友&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/8623/received-fatal-alert-handshake_failure/" data-wpel-link="internal">javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>小蛙的工作常常要維護很多有年代的系統，這些系統有些已經找不到源頭或甚至沒有文件留下來了，前一段時間一直碰到抓 https 的時候噴錯的狀況，這篇把這段很痛苦的經歷記錄下來，希望能幫助遇到相同問題的朋友。</p>



<span id="more-8623"></span>



<p>早期很多網站都是 http 的，到現在各家大廠的推波助瀾下，你沒有 https 就被當作是不合群的、有危險的、跟不上潮流的網站(?!)，總之當有人上你的網站，但你的網站沒有 https 的時候，各大瀏覽器就會很不客氣的提示：您與這個網站的連線不安全，有些人看到這些提示怕都怕死了根本不敢連～</p>



<p>小蛙這次要處理的系統是早期抓網站圖片的工具，由於是早期開發的，當時幾乎都是 http 為主的網站，這支程式也完全沒有考慮 https 的問題 (當時合作的單位完全沒有 https)，這一兩年來這個問題慢慢顯露出來，有些要抓的網站也在我們自己單位，因此可以透過一些特殊的方法來處理，但是今天遇到 &#8230; 要抓外面單位的網站，這 &#8230; 折騰了小蛙一整天啊。</p>



<p class="pre left green">小蛙給一個最簡單卻也是最困難的建議：更新到 JRE 1.8</p>



<p>小蛙試了超多網路上找到的方法，如果你已經在網路上找很久了，那小蛙用的方法你一定都試過，應該也都還是失敗 &#8230; (跟小蛙一樣)，最後決定直接安裝 JRE 1.8。來看一下這討人厭的錯誤訊息</p>



<pre class="wp-block-preformatted withcode">Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
     at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
     at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
     at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1959)
     at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
     at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
     at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
     at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
     at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
     at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
     at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
     at TESTSSL.downloadRemoteImage(TESTSSL.java:37)
     at TESTSSL.downloadRemoteImage(TESTSSL.java:53)
     at TESTSSL.main(TESTSSL.java:74)</pre>



<p>直接看小蛙 Eclipse 的設定，Compiler 的地方使用 1.7 </p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/ACtC-3e9Jzy_2bG9HQE6aGNsNevI25pm7FJoS7MK_g-QL-g7O5Ho40-uzMk3igXTjhZYUpuQ9ja4_KPfJDxNq2Ei60AJbo6GWbhyk5GWis4JIZMNARbGNOWPta4CUK-uMW2VcqeDKyD1UdxsuyqdEUxCKI0Q8Q=w831-h788-no?authuser=2" alt="ACtC 3e9Jzy 2bG9HQE6aGNsNevI25pm7FJoS7MK g QL g7O5Ho40 uzMk3igXTjhZYUpuQ9ja4 KPfJDxNq2Ei60AJbo6GWbhyk5GWis4JIZMNARbGNOWPta4CUK uMW2VcqeDKyD1UdxsuyqdEUxCKI0Q8Q=w831 h788 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>Java Build Path 也是使用 jdk 1.7.0_45</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/ACtC-3f7rafyHQzMcgF3Od_mfpt9y8ZXQoDpnmU51K3zzzML-oZom0p3IkeC5ECLoWU2K2Ic6eiaECBVP6fpa9tjYLmGHAYXkWmkeorJi55ULGHsxLBafeg8IH3YRSZoxO6ncqvAmEyFi3upQFI_iKUEjC38OA=w831-h788-no?authuser=2" alt="ACtC 3f7rafyHQzMcgF3Od mfpt9y8ZXQoDpnmU51K3zzzML oZom0p3IkeC5ECLoWU2K2Ic6eiaECBVP6fpa9tjYLmGHAYXkWmkeorJi55ULGHsxLBafeg8IH3YRSZoxO6ncqvAmEyFi3upQFI iKUEjC38OA=w831 h788 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>Run Configurations 的 JRE 設定也是選擇 jdk 1.7.0_45</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AM-JKLWHU1lL8wQEAIaIRR3gi-P47_XCOsGwV72aWXOkHX_G4e3NOgFI5uFLVBgmOxyOgp4pV36EiE-ZckUO9-AQHbp9ghuyxXFyljn1jn_kFzFQHUTiGMwtWgifDVcWhbB2DzsfTSsAvNpXZv5vCwjusEZrGA=w693-h296-no?authuser=2" alt="AM JKLWHU1lL8wQEAIaIRR3gi P47 XCOsGwV72aWXOkHX G4e3NOgFI5uFLVBgmOxyOgp4pV36EiE ZckUO9 AQHbp9ghuyxXFyljn1jn kFzFQHUTiGMwtWgifDVcWhbB2DzsfTSsAvNpXZv5vCwjusEZrGA=w693 h296 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>執行下去就是這個錯誤 &#8230;</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/ACtC-3f9jG0XqkmNx4fEHhjEK90x9RWkI-C3TYAjN7SxSuC5BPHiIOODq3mSyGK5YMRRwZ6Txt3q9yNt0R75LCOpFalfA74bFUUKtHOQ0KBSJAQ8mBvdHHbvvN1uUBWgdjX12jEetzKb0TapfRn7TC0K39ZwDw=w1357-h400-no?authuser=2" alt="ACtC 3f9jG0XqkmNx4fEHhjEK90x9RWkI C3TYAjN7SxSuC5BPHiIOODq3mSyGK5YMRRwZ6Txt3q9yNt0R75LCOpFalfA74bFUUKtHOQ0KBSJAQ8mBvdHHbvvN1uUBWgdjX12jEetzKb0TapfRn7TC0K39ZwDw=w1357 h400 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>如果手動安裝了 JRE 8，然後把 Run Configurations 的 JRE 設定成 JRE 8</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AM-JKLXwW-GbryLhs1UBdvpWDXYSb6Thx52bsxaVDbxndptJjpt_Vc2qrQ2zyx0ih1P6aSrZL2hNoUsH5P_ezZ7AAd5YR4x-yOITS2WcCkx-rT07BvWLix9BLbIOcs-v67eos6VLo3VsUxWOiwIlK3u6xkYi7Q=w686-h282-no?authuser=2" alt="AM JKLXwW GbryLhs1UBdvpWDXYSb6Thx52bsxaVDbxndptJjpt Vc2qrQ2zyx0ih1P6aSrZL2hNoUsH5P ezZ7AAd5YR4x yOITS2WcCkx rT07BvWLix9BLbIOcs v67eos6VLo3VsUxWOiwIlK3u6xkYi7Q=w686 h282 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>就打完收工了 &#8230; 真的是太敢動 (嗚嗚嗚)，原本小蛙一直想要在 1.7 的環境下想辦法處理，試了一大堆方法沒有一個可以動的，因為改來改去改到亂七八糟，就連把環境升上 1.8 也都還是不行 &#8230; 後來發現 Eclipse 執行的時候可以選擇運行環境，就決定專案的 Compiler 跟 Build Path 維持 1.7，Run Configurations 改成 JRE 1.8 &#8230; 不想繼續糾結下去 Orz &#8230; 但有一些 JSP 環境下沒辦法這樣處理的還是很頭大啊 >&lt;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/8623/received-fatal-alert-handshake_failure/" data-wpel-link="internal">javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/8623/received-fatal-alert-handshake_failure/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
