Skip to Main Content

Java APIs

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!

POP3 via SSL not working

kamilpMar 21 2011 — edited Mar 22 2011
Hi,

I have pop3 ssl server with my own certificate. When I connect to it using the code below, I allways get error "unable to find valid certification path to requested target". From documentation I understand that mail.pop3.ssl.trust set to * should help, but I am still getting this error.

Properties pop3Props = new Properties();
pop3Props.setProperty("mail.pop3.ssl.trust", "*");
pop3Props.setProperty("mail.pop3.port", "995");
URLName url = new URLName("pop3", config.recvHost, 995, "", config.recvLogin, config.recvPassword);
session = Session.getInstance(pop3Props, null);
store = new POP3SSLStore(session, url);
store.connect();

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target".

I was trying to create my own TrustManager, but cant get it working neither. Is there way how to connect to pop3 via ssl without valid certificate ? I definitely dont want to install the certificate using keytool.

Thanks for help
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2011
Added on Mar 21 2011
12 comments
819 views