Lars Kaulen created CXF-7488:
--------------------------------
Summary: 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
Priority: Minor
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 used 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)