本教程为gevin.me原创文章,转载请注明: CAS SSO:配置过程中的错误解决方法 | Gevin’s Blog
本文将收集在配置CAS SSO遇到的所有错误,希望对大家有帮助,也方便下次搭建的时候可以参考!
一、java.lang.exception connector attribute sslcertificatefile must be defined when using ssl with apr
Tomcat启动报如上错误,只需要将conf\server.xml里面的以下内容注释掉即可:
2 |
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> |
二、unable to find valid certification path to requested target
今天在练习CAS SSO时,访问授权页面后跳转到cas认证界面,当输入用户名和密码后,报以下错误:
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
原因:客户端jre没有导入cas server生成的证书,或者导入到错误的jre路径。请记得,一定要导入到Tomcat指向的jre目录下。
导入的命令如下:
1 |
C:\Java\jdk1.6.0_27\bin>keytool - import - alias tomcat_client -trustcacerts - file "C:\Tomcat6_CAS\keystore\gevinme.cert" -keystore "C:\Java\jre6\lib\security\cacerts"
|
三、keytool错误: java.io.IOException: Keystore was tampered with, or password was incorrect
导入证书时报如上错误,原因是已经存在了一个keystore或密码不正确,解决办法是在确认密码无误的情况下,根据别名删除掉已存在的证书,或者最简单的办法就是删除掉C:\Java\jre6\lib\security\cacerts文件(前提是确认了jre里面没有导入过其它正在使用的证书)。
四、javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching xxx.xxx.xx found
检查web.xml中的配置
2 |
< param-name >casServerLoginUrl</ param-name >
|
确保其中的sso.gevin.me跟生成证书时第一个问填写的域名是一致的。如图:
四、org.jasig.cas.ticket.TicketCreationException: error.authentication.credentials.bad
完整错误如下:
ERROR [org.jasig.cas.web.ServiceValidateController] – <TicketException generating ticket for: [callbackUrl: http://client.gevin.me/clientA/proxyCallback]>
org.jasig.cas.ticket.TicketCreationException: error.authentication.credentials.bad
解决办法:
将web.xml中下面配置注释掉,使用代理时才需要用proxyCallback
2 |
< filter-name >CAS Validation Filter</ filter-name >
|
3 |
< filter-class >org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</ filter-class >
|
5 |
< param-name >casServerUrlPrefix</ param-name >
|
9 |
< param-name >serverName</ param-name >
|
14 |
<param-name>proxyCallbackUrl</param-name>
|
18 |
<param-name>proxyReceptorUrl</param-name>
|
19 |
<param-value>/clientB/proxyCallback</param-value>
|
本文固定链接: http://gevin.me/482.html | Gevin's Blog