我正在使用Camel-undertow通过HTTP配置TLS配置发送请求: 如果没有SSL配置,我可以成功通过HTTP2发送消息。为UndertowComponent配置SSL上下文参数后,发件人开始报告以下错误:
java.io.EOFException: EOF reached while reading
at jdk.incubator.httpclient/jdk.incubator.http.Http1AsyncReceiver$Http1TubeSubscriber.onComplete(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$ReadSubscription.signalCompletion(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$InternalReadSubscription.read(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$SocketFlowTask.run(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler$SchedulableTask.run(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler.runOrSchedule(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler.runOrSchedule(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$InternalReadSubscription.signalReadable(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$ReadEvent.signalEvent(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$SocketFlowEvent.handle(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.handleEvent(Unknown Source)
at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.run(Unknown Source)
在Camel应用程序中没有异常,只有少数与org.apache.camel.util.jsse.BaseSSLContextParameters相关的调试语句
"Using SSLEngineImpl.
2018-06-13 12:11:06,549 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:engineCreateSSLEngine:881) [XNIO-2 I/O-3] | SSLEngine [50818ec5[SSLEngine[hostname=127.0.0.1 port=65113] SSL_NULL_WITH_NULL_NULL]] created from SSLContext [javax.net.ssl.SSLContext@56c4278e].
2018-06-13 12:11:06,550 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:configure:353) [XNIO-2 I/O-3] | Configuring SSLEngine [50818ec5[SSLEngine[hostname=127.0.0.1 port=65113] SSL_NULL_WITH_NULL_NULL]] with
explicitly set cipher suites [null],
cipher suite patterns [null],
available cipher suites [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, … TLS_EMPTY_RENEGOTIATION_INFO_SCSV]],
currently enabled cipher suites [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256… TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, … TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]],
and default cipher suite patterns [Patterns [includes=[.*], excludes=[.*_NULL_.*, .*_anon_.*, .*_EXPORT_.*, .*_DES_.*]]].
Resulting enabled cipher suites are [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_.. TLS_EMPTY_RENEGOTIATION_INFO_SCSV]].
2018-06-13 12:11:06,550 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:configure:372) [XNIO-2 I/O-3] | Configuring SSLEngine [50818ec5[SSLEngine[hostname=127.0.0.1 port=65113] SSL_NULL_WITH_NULL_NULL]] with
explicitly set protocols [null],
protocol patterns [null],
available protocols [[SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2]],
currently enabled protocols [[SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2]],
and default protocol patterns [Patterns [includes=[.*], excludes=[SSL.*]]].
Resulting enabled protocols are [[TLSv1, TLSv1.1, TLSv1.2]].
XNIO-2 I/O-3, called closeInbound()
XNIO-2 I/O-3, closeInboundInternal()
XNIO-2 I/O-3, closeOutboundInternal()
XNIO-2 I/O-3, called closeOutbound()
XNIO-2 I/O-3, closeOutboundInternal()
Using SSLEngineImpl.
2018-06-13 12:11:06,620 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:engineCreateSSLEngine:881) [XNIO-2 I/O-4] | SSLEngine [6d696524[SSLEngine[hostname=127.0.0.1 port=65114] SSL_NULL_WITH_NULL_NULL]] created from SSLContext [javax.net.ssl.SSLContext@56c4278e].
2018-06-13 12:11:06,622 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:configure:353) [XNIO-2 I/O-4] | Configuring SSLEngine [6d696524[SSLEngine[hostname=127.0.0.1 port=65114] SSL_NULL_WITH_NULL_NULL]] with
explicitly set cipher suites [null],
cipher suite patterns [null],
available cipher suites [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, …, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]],
currently enabled cipher suites [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256…, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]],
and default cipher suite patterns [Patterns [includes=[.*], excludes=[.*_NULL_.*, .*_anon_.*, .*_EXPORT_.*, .*_DES_.*]]].
Resulting enabled cipher suites are [[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256… TLS_EMPTY_RENEGOTIATION_INFO_SCSV]].
2018-06-13 12:11:06,642 org.apache.camel.util.jsse.BaseSSLContextParameters DEBUG (BaseSSLContextParameters.java:configure:372) [XNIO-2 I/O-4] | Configuring SSLEngine [6d696524[SSLEngine[hostname=127.0.0.1 port=65114] SSL_NULL_WITH_NULL_NULL]] with
explicitly set protocols [null],
protocol patterns [null],
available protocols [[SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2]],
currently enabled protocols [[SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2]],
and default protocol patterns [Patterns [includes=[.*], excludes=[SSL.*]]].
Resulting enabled protocols are [[TLSv1, TLSv1.1, TLSv1.2]].
XNIO-2 I/O-4, called closeInbound()
XNIO-2 I/O-4, closeInboundInternal()
XNIO-2 I/O-4, closeOutboundInternal()
XNIO-2 I/O-4, called closeOutbound()
XNIO-2 I/O-4, closeOutboundInternal()"
以下是我的骆驼应用程序的片段
from("undertow:http://127.0.0.1:10199/Common")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("Message received :" +
exchange.getIn().getBody(String.class));
}
})
.to("direct://protocolConverter");
from("direct://protocolConverter").
to("undertow:https://localhost:8081/testEndpoint1");
//In main method
context.addComponent("undertow", getUndertowComponent(context));
//outside main
static UndertowComponent getUndertowComponent(CamelContext context){
UndertowComponent uc = new UndertowComponent(context);
UndertowHostOptions uho = new UndertowHostOptions();
uho.setHttp2Enabled(true);
uc.setHostOptions(uho);
// uc.setUseGlobalSslContextParameters(true);
//to enabled SSL support on undertow
configureSSLforUndertow(uc);
return uc;
}
static void configureSSLforUndertow(UndertowComponent uc) {
KeyStoreParameters trust_ksp = new KeyStoreParameters();
trust_ksp.setResource("/cacerts.jks");
trust_ksp.setPassword("changeit");
TrustManagersParameters trustp = new TrustManagersParameters();
trustp.setKeyStore(trust_ksp);
SSLContextParameters scp = new SSLContextParameters();
scp.setTrustManagers(trustp);
uc.setSslContextParameters(scp);
}
我不知道为什么下载不支持启用SSL,我已经尝试过类似的配置,使用camel-HTTP4启用SSL,它按预期工作但是使用Camel-undertow,它没有足够的问题症状就失败了。甚至不打印路径1中的println。我现在被封锁了。 如果有人你已经面临同样的问题。请分享您的知识。
使用的Camel版本:Apache Camel 2.21.1
注意:我已经验证了证书,相同的证书正在使用Http4组件。
注意:我已从日志中删除了密码列表以使其更具可读性