Buscar este blog

domingo, 22 de marzo de 2015

javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name

This error occurs when you are trying to connect to a https direction and the host name does not match de server name returned in the response message.


javax.net.ssl.SSLProtocolException: handshake alert:  unrecognized_name
        sun.security.ssl.ClientHandshaker.handshakeAlert(ClientHandshaker.java:1292)
        sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1952)
        sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
        sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
        sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
        sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
        sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
        sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
        sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
        sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
        org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:986)
        org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:143)
        org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:802)
        org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
        org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
        org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:230)
        org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:285)
        com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2101)
        com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2303)
        com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2335)
        org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:263)
        org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:206)
        org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:98)
        org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)
        org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149)
        org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.<init>(ProviderImpl.java:509)
        org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:204)
        javax.xml.ws.Service.<init>(Service.java:57)
        javax.xml.ws.Service.create(Service.java:687)
        org.springframework.remoting.jaxws.LocalJaxWsServiceFactory.createJaxWsService(LocalJaxWsServiceFactory.java:137)
        org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.prepare(JaxWsPortClientInterceptor.java:334)
        org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.invoke(JaxWsPortClientInterceptor.java:484)
        org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        com.sun.proxy.$Proxy118.getPerfilesUsuario(Unknown Source)

Using apache, you have to configure propertly the virtual host. Set ServerName and ServerAlias to match de domain name.


<VirtualHost _default_:443>

(..)

ServerName jboss01.localdomain:443
ServerAlias jboss01.localdomain

(...)

SSLCertificateFile /etc/httpd/keystores/server_jboss01.cer
SSLCertificateKeyFile /etc/httpd/keystores/server_jboss01.key
SSLCertificateChainFile /etc/httpd/keystores/server_cas.pem

(...)
</VirtualHost>

In this case, the URL should be https://jboss01.localdomain/xxxxxx.

Note, in the server certificate, the Common Name (CN) must be also jboss01.localdomain

No hay comentarios:

Publicar un comentario