java - Websphere + Tomcat : CertificateException

标签 java tomcat websphere

我在 2 个不同的服务器上部署了 2 个应用程序,我的 GUI 应用程序在 Tomcat 上,CAS(中央身份验证)在 Websphere 上。我已经创建了 keystore 文件并在 tomcat conf 的 server.xml 中更新了相同的文件。

请在下面找到条目。

Tomcat :

<Environment name="config/centralCasServerLoginURL" 
type="java.lang.String" value="https://localhost:9443/my-sso-web/login?
method=POST"/>
Tomcat: <Environment name="config/applicationServiceURL" 
type="java.lang.String" value="https://localhost:8443/bank-client-
web/j_spring_cas_security_check"/>*

<Connector SSLEnabled="true" clientAuth="false" 
keystoreFile="C:\tmp\newKeystore1" 
         keystorePass="password" maxThreads="200" port="8443"
         protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" 
secure="true" sslProtocol="TLS"/>*

我能够单独运行这两个应用程序,但是当我当时配置 CASAuthentication 配置文件时,我能够登录 CAS,但在它重定向到我的 GUI 应用程序 URL(即 https://localhost:8443/bank-client-web/j_spring_cas_security_check)后,它抛出以下错误。

你能帮我吗?

SEVERE: Servlet.service() for servlet [default] in context with path [/bank-
client-web] threw exception
java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: 
java.security.cert.CertificateException: No name matching localhost found
    at org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:295)
    at org.jasig.cas.client.validation.AbstractCasProtocolUrlBasedTicketValidator.retrieveResponseFromServer(AbstractCasProtocolUrlBasedTicketValidator.java:33)
    at org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:178)
    at org.springframework.security.cas.authentication.CasAuthenticationProvider.authenticateNow(CasAuthenticationProvider.java:131)
    at org.springframework.security.cas.authentication.CasAuthenticationProvider.authenticate(CasAuthenticationProvider.java:117)
    at org.springframework.security.authentication.ProviderManager.doAuthentication(ProviderManager.java:130)
Caused by: javax.net.ssl.SSLHandshakeException: 
java.security.cert.CertificateException: No name matching localhost found
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)     
Caused by: java.security.cert.CertificateException: No name matching localhost found
    at sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:221)
    at sun.security.util.HostnameChecker.match(HostnameChecker.java:95)
    ... 55 more

最佳答案

这只是您的客户端库执行严格的主机名验证,将 URL 中的“localhost”与 WebSphere 证书对其有效的主机进行比较。

最简单的解决方法是通过它的实际主机名而不是本地主机来寻址此服务器。

关于java - Websphere + Tomcat : CertificateException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44354717/

相关文章:

database - 在服务器上存储文件的最佳方法是什么(在数据库中或单独存储位置)?

websphere - 我是否需要启用 DRS 才能在 Websphere Application Server 集群中使用 Dynacache

java - java类加载器是否验证方法体?

java - 如何在 Java 中实现具有内部依赖性的惰性评估有状态类?

java - 哪个订单? ProGuard + JWrapper + Launch4J

android - 更改 gridview 项目的字体大小 (Android)

tomcat - 如何模拟产品环境

java - 在 Elastic Beanstalk 上更改 Apache Tomcat 的文件编码

java - 在Windows的tomcat服务器上托管的Java程序中显示Unicode字符

servlets - Websphere 中的 Log4j