You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org> on 2017/11/28 10:43:17 UTC

[jira] [Closed] (CXF-7488) Protocol Mismatch when using Netty with TLS

     [ https://issues.apache.org/jira/browse/CXF-7488?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh closed CXF-7488.
------------------------------------

> Protocol Mismatch when using Netty with TLS
> -------------------------------------------
>
>                 Key: CXF-7488
>                 URL: https://issues.apache.org/jira/browse/CXF-7488
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 3.1.12
>         Environment: Windows 7, JDK 1.8.0_144
>            Reporter: Lars Kaulen
>            Assignee: Colm O hEigeartaigh
>            Priority: Minor
>             Fix For: 3.1.13, 3.2.0
>
>
> I'm using the classes NettyHttpServerEngineFactory and NettyHttpServerEngine to configure a server with TLS using only Java code (without Spring or other XML configurations). Therefore I constructed the necessary TLSServerParameters and created an engine factory:
> {noformat}
> TLSServerParameters tlsParams = new TLSServerParameters();
> tlsParams.setKeyManagers(km);
> tlsParams.setTrustManagers(tm);
> tlsParams.setCipherSuitesFilter(filter);
> tlsParams.setClientAuthentication(ca);
> NettyHttpServerEngineFactory factory = new NettyHttpServerEngineFactory(sf.getBus());
> Map<String, TLSServerParameters> tlsParamsMap = new HashMap<>();
> tlsParamsMap.put(Integer.toString(port), tlsParams);
> factory.setTlsServerParameters(tlsParamsMap);
> {noformat}
> Where sf is an object of JaxWsServerFactoryBean and I previously initialized all the necessary KeyManagers etc.
> Afterwards I want to create an engine using the factory:
> {noformat}
> NettyHttpServerEngine engine = localFactory.createNettyHttpServerEngine(port, "https");
> {noformat}
> Afterwards I get the following Exception:
> {noformat}
> java.io.IOException: Protocol mismatch for port 4816: engine's protocol is http, the url protocol is https
> 	at org.apache.cxf.transport.http.netty.server.NettyHttpServerEngineFactory.createNettyHttpServerEngine(NettyHttpServerEngineFactory.java:184)
> 	at org.apache.cxf.transport.http.netty.server.NettyHttpServerEngineFactory.createNettyHttpServerEngine(NettyHttpServerEngineFactory.java:194)
> {noformat}
> When looking at the (really similar) class ??JettyHTTPServerEngineFactory?? there is a method ??retrieveListenerFactory?? called in methods ??setTlsServerParameters?? and ??finalizeConfig?? which changes the protocol of the engine to https when tls parameters are provided, in ??NettyHttpServerEngineFactory?? it doesn't exist so far and the ??finalizeConfig?? method is empty.
> Could you provide something similar to used code in ??JettyHTTPServerEngineFactory?? aswell in ??NettyHttpServerEngineFactory?? as it would solve my problems perfectly.
> Let me know if I need to provide any other informations/code.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)