Strange Handshake problem
Hallo!
I have the following simple piece of code that simply should connect to my tomcat using SSL. However I always get a strange exception. I run it using the VM Parameter: -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol
. The really strange thing is, that when I test it against a random SSL page on the web it works. For example using https://e-campus.uibk.ac.at I don't get an exception... any idea what I could have messed up?
The code:
public
class Test
{
public
static
void
main(String [] arstring)
{
try
{
new java.net.URL("https://localhost:8443/").getContent();
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}
The Exception:
D:\>java -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol Test
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building f
ailed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certificatio
n path to requested target
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)

