Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java newbie requesting help

2 views
Skip to first unread message

Stephen Biggs

unread,
Dec 15, 2002, 3:05:18 AM12/15/02
to
This isn't working. The certificates are defined correctly. When I try
this:

import java.nio.charset.Charset ;
import java.io.* ;
import java.net.* ;

// classes for ssl
import javax.net.ssl.* ;
import java.security.Security;

class MyClient {
public static void main(String[] args)
throws Exception {

System.setProperty("javax.net.ssl.trustStore","C:\\.keystore");
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www
.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());


URL url = new URL("https://localhost:8443/examples/servlet/MyServer");
URLConnection conn = url.openConnection() ;

conn.setDoOutput(true) ;
ObjectOutputStream out = new ObjectOutputStream(conn.getOutputStream()) ;

... I get:

Exception in thread "main" java.io.IOException: HTTPS hostname wrong: should
be <localhost>
at sun.net.www.protocol.https.HttpsClient.b(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6
275)
at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection
.java:528)
at
com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl.getOutp
utStream(DashoA6275)
at MyClient.main(MyClient.java:38)

Any insights would be appreciated.

0 new messages