| Author |
java.net.UnknownHostException using JSSE
|
alberto ag
Greenhorn
Joined: Feb 01, 2006
Posts: 2
|
|
Hi all, I�m testing some code and trying to connect to a secure site through JSSE. When connecting I�m finding all the time the same exception: java.net.UnkownHostException. This is the exception thrown: java.net.UnknownHostException: www.paypal.com at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source) at sun.net.www.protocol.https.HttpsClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source) at sun.net.www.protocol.https.HttpsClient.a(Unknown Source) at sun.net.www.protocol.https.HttpsClient.a(Unknown Source) at sun.net.www.protocol.https.HttpsClient.a(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) I�ve configured my keystore and trustore (correctly?) and no complaints about it. I�m behind a proxy, but that�s now ok (I�m authenticating correctly). The funny thing is that when connecting to a non-secure site the connection works perfectly. This is my code: import java.net.*; import java.io.*; public class TestSSL{ public MichelSSL(){ try{ System.getProperties().put("proxySet", "true"); System.getProperties().put("proxyHost", "proxysite"); System.getProperties().put("proxyPort", "8080"); Authenticator.setDefault(new MyAuthenticator()); String inputLine; //URL url = new URL("http://www.verisign.com:443"); URL url = new URL("https://www.paypal.com"); //URL url = new URL("http://www.google.com"); URLConnection conn = url.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader(conn.getInputStream())); while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); }catch(Exception e){ e.printStackTrace(); } } public static void main(String args[]){ TestSSL tp = new TestSSL(); } } class MyAuthenticator extends Authenticator{ protected PasswordAuthentication getPasswordAuthentication(){ return new PasswordAuthentication("user", "pass".toCharArray()); } } Any ideas what�s going wrong??? All help will be much appreciated. thanks Alberto.
|
 |
 |
|
|
subject: java.net.UnknownHostException using JSSE
|
|
|