學習CAS實現SSO單點登錄
網上找了幾篇比較詳細的教程,在這記錄一下:
原理:
教程:
有可能出現的問題解決方案:
1.unable to find valid certification path to requested target
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 Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2.PKIX path building failed的問題
這是缺少安全證書時出現的異常,解決方案就是將你要訪問的webservice的安全認證證書導入到客戶端即可。以下是獲取安全證書的一種方法
http://www.oschina.net/question/12_19249?fromerr=tBx3HSNp
其實出現上面兩種異常,基本上問題都出在證書上。
關鍵是與教程步驟都是一樣的,為什么生成的證書會有問題呢?
我自己就出了一種奇葩的錯誤,搞了一天終於發現錯誤所在。
原因竟然是:
在JDK安裝時將JDK和JRE放在了同一目錄下,
JDK目錄下原本就有一個jre文件夾。
然后安裝JRE的時候,如果與JDK放在同一個目錄下,
就會導致了前者被覆蓋,這個時候JDK其實是不完整的。
用這個JDK的KeyTool制作證書的時候,證書就有問題。