This discussion is archived
5 Replies Latest reply: May 9, 2012 3:55 PM by EJP RSS

Trouble connecting to SSL / TLS website via Java JDK - Why isn't it working

user13136504 Newbie
Currently Being Moderated
Here is the important part. When compiled and run:
String Urlx="https://domain.com" // valid URL that comes up fine in a web browser
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(Urlx);
in = url.openStream(); // Currently An IoException is thrown
:

It appears an IoException is thrown: java.io.IOException: Server returned HTTP response code: 403 for URL: https://domain.com

Does anyone know why this might be happening and what if anything is missing? e.g missing .jar file? A different way to accomplish this in Java JDK?

What is happening here? Should I use wireshark to get mroe information about this? What java tools should I be using to get more information on why this is not working?
I can compile the code shown above but that 403 error and IoException are very troubling!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points