【问题标题】:Camel CXF Rest SSL Handshake ErrorCamel CXF Rest SSL 握手错误
【发布时间】:2015-04-23 20:54:12
【问题描述】:

我们使用 Camel CXF API 与安全服务器进行通信。这是 2-way SSL,我们正在通过 Netscaler 与 3 个不同的系统通信。 2 个系统公开 SOAP WS,我们能够建立 2-way SSL 并交换消息。第三个系统公开了 REST API,并且在 SSL 握手时出现了一个非常奇怪的问题。当我们在 Fuse 中使用 Camel CXF 时会发生错误。在自己的 JVM 中运行的独立 Java 程序能够成功地与 REST 服务通信。

我们已启用 SSL 调试标志并在日志中收到以下错误。

Camel thread #0 - timer://foo, WRITE: TLSv1 Change Cipher Spec, length = 1
Camel thread #0 - timer://foo, handling exception: java.net.SocketException: Connection reset
%% Invalidated:  [Session-11, SSL_RSA_WITH_RC4_128_MD5]
Camel thread #0 - timer://foo, SEND TLSv1 ALERT:  fatal, description = unexpected_message
Camel thread #0 - timer://foo, WRITE: TLSv1 Alert, length = 2
Camel thread #0 - timer://foo, Exception sending alert: java.net.SocketException: Broken pipe
Camel thread #0 - timer://foo, called closeSocket()

这是 Camel REST svc 中的配置。

<!-- Key Manager & Trust Manager -->
<bean id="keyManagersBean" 
          class="test.IntegrationKeyManagerFactory" 
          factory-method="getKeyManager">
    <argument value="${security.keystorepassword}"/>
    <argument value="${security.keystorelocation}"/>
</bean> 

<bean id="trustManagersBean" 
      class="test.IntegrationKeyManagerFactory" 
      factory-method="getTrustManager">
    <argument value="${security.keystorepassword}"/>
    <argument value="${security.keystorelocation}"/>
</bean>

<!-- ==================== security configuration =================== -->
<http:conduit name="*.http-conduit">
    <http:tlsClientParameters>
        <sec:keyManagers ref="keyManagersBean"/>
        <sec:trustManagers ref="trustManagersBean"/>
    </http:tlsClientParameters>
</http:conduit>

<!-- ====================== Camel Context & Routes ====================== -->
<camel:camelContext id="camel.test.context">
    <camel:route id="testRoute">
        <camel:from uri="timer://foo?fixedRate=true&amp;period=30s" />
        <camel:transform>
            <camel:constant>""</camel:constant>
        </camel:transform>
        <camel:removeHeaders pattern="CamelCxfMessage" />
        <camel:setHeader headerName="Exchange.HTTP_METHOD">
            <camel:constant>GET</camel:constant>
        </camel:setHeader>
        <camel:to uri="cxfrs:{{protocol}}://{{host}}:{{port}}/{{context}}/getList" />
        <camel:log message="${body}"/>
    </camel:route>
</camel:camelContext>

有谁知道可能是什么问题?完全相同的配置适用于通过 netscaler 与 SOAP WS 通信,但不适用于通过 netscaler 与 REST WS 通信。

【问题讨论】:

  • 在我们发现由于某种原因 HTTP Conduit 中的 TLSClientParameters 为空的问题上取得了一些进展。为什么会发生这种情况?

标签: ssl client cxf


【解决方案1】:

我能够通过从camel cxf rsClient 切换到使用普通camel-http 调用来解决这个问题。但是认为将 HttpConduit 与 cxfrsClient 一起使用存在一些问题。

【讨论】:

    猜你喜欢
    • 2017-02-11
    • 1970-01-01
    • 2015-02-03
    • 2016-08-08
    • 2016-04-13
    • 1970-01-01
    • 1970-01-01
    • 2016-08-22
    • 2014-01-14
    相关资源
    最近更新 更多