---
title: "邮件服务器证书认证不通过"
author: "toolkit1216"
date: "2011-12-02T14:53:29Z"
tags: []
categories: ["行业应用"]
slug: "untitled"
draft: false
lastmod: "2011-12-02T14:54:44Z"
id: 1289493
url: "https://toolkit1216.iteye.com/blog/1289493"
---

邮件服务证书认证不通过  
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

这是缺少安全证书时出现的异常，解决方案就是将你要访问的webservice的安全认证证书导入到客户端即可。以下是获取安全证书的一种方法.

为邮件服务器生成证书  
1、运行 java InstallCert  邮件服务器地址  
2、将在控制台输入1，然后回车  
2、得到jssecacerts文件后复制到到${JAVA\_HOME}\\jre\\lib\\security目录