<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Error Solved &#187; java</title>
	<atom:link href="http://solveme.wordpress.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://solveme.wordpress.com</link>
	<description>Finally I solved the error</description>
	<lastBuildDate>Wed, 11 Nov 2009 07:19:00 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='solveme.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/605bab9a55109a23e84e1160bb1e5c3b?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Error Solved &#187; java</title>
		<link>http://solveme.wordpress.com</link>
	</image>
			<item>
		<title>SSLHandshakeException: When trying trying to access a HTTPS URL</title>
		<link>http://solveme.wordpress.com/2008/12/10/javax-net-ssl-sslhandshakeexception/</link>
		<comments>http://solveme.wordpress.com/2008/12/10/javax-net-ssl-sslhandshakeexception/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 14:05:40 +0000</pubDate>
		<dc:creator>daringtakers</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[exception]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://solveme.wordpress.com/?p=39</guid>
		<description><![CDATA[I was trying to access a HTTPS URL using java.net.HttpURLConnection and got following error.
Error
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Most of the time, this exception occurs when you are using selfsigned certificate.
Reason:  The host that you are trying to connect has an self signed certificate, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=solveme.wordpress.com&blog=4112608&post=39&subd=solveme&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was trying to access a HTTPS URL using java.net.HttpURLConnection and got following error.</p>
<p>Error<br />
<code>javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</code><br />
Most of the time, this exception occurs when you are using selfsigned certificate.</p>
<p><strong>Reason</strong>:  The host that you are trying to connect has an self signed certificate, and that certificate is not in your truststore.</p>
<p><strong>Description</strong>:<br />
Actually I am using the tomcat server and I have enabled HTTPS connector. I have created a selfsigned certificate for the tomcat.</p>
<p>I have a standalone Java program which connects to the server and downloads file over HTTPS. But when I try to connect to the server, it threw SSLHandshakeException.</p>
<p><strong>Solution</strong>:  Solution to resolve this exception is to import the selfsigned certificate into the system truststore.<br />
Below steps explains how to do it.</p>
<h3>Step-1: Export the certificate.</h3>
<p>Export your self signed certificate using keytool utility provided with JDK.open the command prompt and change current directory to JAVA_HOME/bin. Now run following command.<br />
<code><br />
keytool  -export -alias tomcat -storepass changeit  -file tomcat.cer<br />
</code><br />
It will create a tomcat.cer file in the current directory.</p>
<p><strong>Note: You may need to modify -alias and -storepass options if required. Default keystore  password is &#8216;changeit&#8217;.</strong></p>
<h3>Step-2: Import the certificate into truststore.</h3>
<p><code> keytool -import -alias tomcat -file tomcat.cer -keystore &lt;path to JAVA_HOME&gt;\jre\lib\security\cacerts</code><br />
or<code><br />
keytool -import -alias tomcat -file tomcat.cer -keystore ..\jre\lib\security\cacerts<br />
</code><br />
It will ask you to enter keystore password. Default password is &#8216;changeit&#8217;.  when it ask, &#8216;Trust this certificate?&#8217;, type yes and press enter.</p>
<h3>Step-3: Verify that the certificate is added successfully</h3>
<p><code> keytool -list -keystore C:\j2sdk1.4.2_16\jre\lib\security\cacerts<br />
</code><br />
It will list all the certificate. verify that the certificate you just added is present in list.</p>
<p>That&#8217;s it! now run your program again.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/solveme.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/solveme.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/solveme.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/solveme.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/solveme.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/solveme.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/solveme.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/solveme.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/solveme.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/solveme.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=solveme.wordpress.com&blog=4112608&post=39&subd=solveme&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://solveme.wordpress.com/2008/12/10/javax-net-ssl-sslhandshakeexception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/66e04160aa66aeb25c4340959c5f2995?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">daringtakers</media:title>
		</media:content>
	</item>
	</channel>
</rss>