Women in Technology

Hear us Roar



Article:
  Secure Your Sockets with JSSE
Subject:   Caused by: java.io.IOException: HTTPS hostname wrong: should be <192.168.10.142>
Date:   2007-02-06 02:41:19
From:   annu_itech
Dear Jamie


I have to implement https using jsse. your site has helped me to get started...am stuck up with some doubts and problems when i reached on the 4th page(http://www.onjava.com/pub/a/onjava/2001/05/03/java_security.html?page=4) i came across the following exception on the client side..
and an IOException on the server side.
can you please enlighten on why am i getting that exception and what should i do to remove that exception.
C:\j2sdk1.4.2\jre\lib\security\Client>java SecureBrowser https://192.168.10.142/


THE HEADERS
-----------
Exception in thread "main" java.io.IOException
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:591)
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl
.getInputStream(DashoA6275)
at Browser.run(Browser.java:36)
at SecureBrowser.main(SecureBrowser.java:14)
Caused by: java.io.IOException: HTTPS hostname wrong: should be <192.168.10.142
>
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
(DashoA6275)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:615)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderFieldKey(HttpURL
Connection.java:1485)
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl
.getHeaderFieldKey(DashoA6275)
at Browser.run(Browser.java:31)
... 1 more


C:\j2sdk1.4.2\jre\lib\security\Client>java SecureBrowser https://toshiba-user/
THE HEADERS
-----------
KEY: Content-Length
VALUE: 499
KEY: Content-Type
VALUE: text/html
THE CONTENT
-----------
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Welcome to Java Security using JSSE</title>
</head>


<body>
<h1>Welcome to Java Security using JSSE</h1>


This page was securely sent using SSL version 3.0.


</body>
</html>


thanking you
annu