话说,我在本地测试cas单点登录都已经ok了,没有问题了,但是发布到本地服务器上一直都抛出一个异常,而且,经过测试,配置的cas服务器是没有问题的,如果不进行跳转,是可以登录成功的,而,cas客户端配置也没有太大问题,我觉得,因为,只是简单的配置个web.xml文件,然后,在加上两个jar包。其他的也没什么。 从异常信息来看,应该是证书的问题,大家知道,cas登录一个关键因素就是导入证书到jdk中。但是,我也做了很多遍生成证书,导入证书,各种折腾,还是会抛异常。 想了很多遍,我又想到的一点是,是不是tomcat的jdk版本是自带的,是不是需要手工指定某特定的jdk.然后又上网查资料,手工指定jdk,结果还是一样的。 实在没辙了。各位大牛给分析分析,到底是哪一步出问题了。 以上,是我个人的分析。不知有没有错。 谢谢。。 2013-7-12 16:05:18 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet jsp threw exception java.lang.RuntimeException: 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 at org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:341) at org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:305) at org.jasig.cas.client.validation.AbstractCasProtocolUrlBasedTicketValidator.retrieveResponseFromServer(AbstractCasProtocolUrlBasedTicketValidator.java:50) at org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:207) at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:169) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at cn.jsprun.filter.FileCaptureFilter.doFilter(FileCaptureFilter.java:43) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at cn.jsprun.filter.OnlineFilter.doFilter(OnlineFilter.java:195) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at cn.jsprun.filter.GZIPFilter.doFilter(GZIPFilter.java:33) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at cn.jsprun.filter.EncodingFilter.doFilter(EncodingFilter.java:26) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1703) at java.lang.Thread.run(Unknown Source) 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 at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source) at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source) at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:326) ... 31 more Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(Unknown Source) at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) at sun.security.validator.Validator.validate(Unknown Source) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(Unknown Source) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) ... 44 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source) at java.security.cert.CertPathBuilder.build(Unknown Source) ... 50 more |
|
什么情况。。。求解。。。
|
|
竟然木有一个人懂?
|
|
60分 |
你怎么设置的Context, 指定证书,忘记密码没有?
字面上是安全验证错误。。 |
设置context?? 这两个好像都没有设置。我在本地测试的时候没有设置这些,这些该在哪里设置呢??? qq:1054008871,能加qq聊下吗?谢谢。 |
|
我也没做过单点登录,,就会点皮毛。。。
你看下 这个 : http://blog.csdn.net/small_love/article/details/6664831 |
|
谢谢。这不错误已经没有问题了,但又抛出另一个异常。不知道,这是什么情况。 |
|
2013-7-15 12:14:42 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet jsp threw exception org.jasig.cas.client.validation.TicketValidationException: 绁ㄦ牴""ST-2-Q9Z1aYLaaqMXphbo1WCQ-cas01.example.org""涓嶇鍚堢洰鏍囨湇鍔? at org.jasig.cas.client.validation.Cas20ServiceTicketValidator.parseResponseFromServer(Cas20ServiceTicketValidator.java:86) at org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:217) at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:169) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.nodoor.common.util.page.PagerFilter.doFilter(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source) |
|
这是什么情况呢?求大牛!
|
|
20分 |
个人觉得是你测试环境的话,是服务端和客户端都是本地,之后生产环境,服务端和客户端分开的了~这样的话,你需要把你生产的证书加载到客户端。客户端需要制定ssl路径
|
http://mengyang.iteye.com/blog/575671
|
|
谢谢,两个问题都已经解决了。第一个是因为在cas服务器中的conf文件夹中的server.xml文件没有配置证书的路径 |
|
后面抛出的这个异常是因为客户端web.xml文件没有配置好。
<!– 该过滤器负责用户的认证工作,必须启用它 –> <filter> <filter-name>CASFilter</filter-name> <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> <init-param> <param-name>casServerLoginUrl</param-name> <param-value>https://localhost:9443/cas/login</param-value> </init-param> <init-param> <!–这里的server是服务端的IP,特别注意,登录时参数service的参数要和这个路径匹配–> <param-name>serverName</param-name> <param-value>http://localhost:8080/</param-value> </init-param> </filter> |
|
两处地方都要匹配。谢谢各位大牛的指导。谢谢。
|
|
10分 |
search by google.
|
同时现在又面临一个新的挑战,现在的配置的客户端拦截器,是在根目录下拦截,也就是,打开网站就会拦截是否处于登录或未登录状态,如果未登录就要求跳转到登录页面。
那么如何配置在未登录的情况下正常打开网站,而不用跳到登录页面。 最简单的一种方式,就是,修改拦截器的路径 各位大牛,这,怎么破?? |
|
在你验证是否登录的filter中加一个初始化参数,也就是你上面的/login 不进行非登录判断,直接放行。。 <init-param> <param-name>excludedUrls</param-name> <param-value>/login</param-value> </init-param> |
|
不行,还是不行。 <!-- 该过滤器负责用户的认证工作,必须启用它 --> <filter> <filter-name>CASFilter</filter-name> <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> <init-param> <param-name>excludedUrls</param-name> <param-value>/cas/login</param-value> </init-param> <init-param> <param-name>casServerLoginUrl</param-name> <param-value>https://localhost:9443/cas/login</param-value> </init-param> <init-param> <!--这里的server是服务端的IP --> <param-name>serverName</param-name> <param-value>http://localhost:8080/</param-value> </init-param> </filter> <filter-mapping> <filter-name>CASFilter</filter-name> <url-pattern>/login</url-pattern><!-- 拦截器,拦截被登录的页面,与登录链接相呼应 --> </filter-mapping> |
|
求指教~~ |
|
难道非得要去改服务器里的代码才能实现?
|
|
感谢。 |
|
哥们儿 你的sso现在ok了吧?能不能指导一下
|