Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3693770
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:24:59+00:00 2026-05-19T04:24:59+00:00

I’m testing out sending email through my vps and I’ve run into a problem

  • 0

I’m testing out sending email through my vps and I’ve run into a problem when it comes to sending a secure mail through SMTPS. SMTP and POP3 functions work, as the email is successfully sent. SMTPS doesn’t.

I setup a simple test (JSP) page to send off an email. The code is provided below.

           Transport t = null; 


   try {   

      String SMTPS = "mydomainname.com";          

      String Username = "maindomainemail";
      String Password = "myhiddenpassword"; 

            InternetAddress from = new InternetAddress("mrsmith@mydomainname.com", "Bob Smith");         

         Properties props = new Properties();               

      props.setProperty("mail.smtps.auth", "true");      

   props.put("mail.smtps.host", "mydomainname.com");


    String protocol = "smtps";    
    Session ssn = Session.getInstance(props, null);

       ssn.setDebug(true);            

    t = ssn.getTransport(protocol);            
    t.connect(SMTPS,Username,Password);                   

       InternetAddress to = new InternetAddress("mypersonalemail@hotmail.com", "Tom Smith");

       String subject = "testing email";

       String newBody = "message body of email";

          // Create the message
          Message msg = new MimeMessage(ssn);
          msg.setFrom(from);
          msg.addRecipient(Message.RecipientType.TO, to);
          msg.setSubject(subject);
          msg.setContent(newBody, "text/html");
    t.sendMessage(msg, msg.getAllRecipients());                  
    t.close();  

        }//try
             catch (MessagingException mex) {
              mex.printStackTrace(); }          
         catch(Exception e) {}

On my vps, I had to follow instructions to setup secure smtp.

After running the jsp test page, I’m getting the following exceptions in my tomcat log file.

INFO   | jvm 1    | 2011/01/06 12:29:11 | DEBUG: setDebug: JavaMail version 1.4.1
INFO   | jvm 1    | 2011/01/06 12:29:11 | DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc]
INFO   | jvm 1    | 2011/01/06 12:29:11 | DEBUG SMTP: useEhlo true, useAuth true
INFO   | jvm 1    | 2011/01/06 12:29:11 | DEBUG SMTP: trying to connect to host "mydomainname.com", port 465, isSSL true
INFO   | jvm 1    | 2011/01/06 12:29:12 | DEBUG SMTP: exception reading response: 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
INFO   | jvm 1    | 2011/01/06 12:29:12 | javax.mail.MessagingException: Exception reading response;
INFO   | jvm 1    | 2011/01/06 12:29:12 |   nested exception is:
INFO   | jvm 1    | 2011/01/06 12:29:12 |  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
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1611)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at javax.mail.Service.connect(Service.java:288)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at javax.mail.Service.connect(Service.java:169)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jsp.SendEmailViaEappsVPS_005fSMTPS_jsp._jspService(SendEmailViaEappsVPS_005fSMTPS_jsp.java:112)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at java.lang.Thread.run(Thread.java:595)
INFO   | jvm 1    | 2011/01/06 12:29:12 | Caused by: 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
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1584)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:848)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:877)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1089)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:737)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  ... 26 more
INFO   | jvm 1    | 2011/01/06 12:29:12 | Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at sun.security.validator.Validator.validate(Validator.java:203)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:841)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  ... 38 more
INFO   | jvm 1    | 2011/01/06 12:29:12 | Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:236)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:194)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:216)
INFO   | jvm 1    | 2011/01/06 12:29:12 |  ... 43 more

What does this mean? Has anyone seen this type of exception before? What steps do I need to take to fix this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:25:00+00:00Added an answer on May 19, 2026 at 4:25 am

    Java is not finding the SSL certification, you need to manually add the host. You need to add server’s certification to keystore implying it’s your trusted server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.