You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by daniel martin <da...@gmail.com> on 2007/03/13 17:42:56 UTC

Tomcat https

Hi,
I'm trying to get my tomcat instance to connect over https to an external
server.
I have written a test servlet to do this

String httpsURL = "*https*://*example*.microsoft.com";
    URL myurl = new URL(httpsURL);
    HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
    InputStream ins = con.getInputStream();
    InputStreamReader isr=new InputStreamReader(ins);
    BufferedReader in =new BufferedReader(isr);
    String inputLine;
    while ((inputLine = in.readLine()) != null)
    out.println(inputLine);
    in.close();


But always get the following exception

java.net.UnknownHostException: example.microsoft.com
	java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
	java.net.Socket.connect(Socket.java:519)
	java.net.Socket.connect(Socket.java:469)....

Any ideas?

Cheers

Dan

Re: Tomcat https

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
daniel martin wrote:

> I'm trying to get my tomcat instance to connect over https to an external
> server.
> I have written a test servlet to do this
>
> String httpsURL = "*https*://*example*.microsoft.com";

The '*'s aren't really in your code, are they?

> But always get the following exception
>
> java.net.UnknownHostException: example.microsoft.com
> 	java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
> 	java.net.Socket.connect(Socket.java:519)
> 	java.net.Socket.connect(Socket.java:469)....
>
> Any ideas?

Yes.
1. Check the DNS settings of the machine. example.microsoft.com should be 
resolvable.
2. Connect to a server that presents a certificate to your client that matches 
the host's name or set a HostnameVerifier with a verify method that returns 
true for this connection.
3. Connect to a host that actually returns content and not only an error 
message.

BTW: this has nothing to do with Tomcat.

Regards
  mks

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org