Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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

user13136504May 7 2012 — edited May 9 2012
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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 6 2012
Added on May 7 2012
5 comments
1,023 views