首页 > 解决方案 > HTTPS 连接器上无法识别 Spring 属性

问题描述

我正在尝试在 Mule 中创建一个 HTTPS 连接器,以便可以将 HTTPS 端点作为流的一部分调用。但是,当我尝试添加sslTypespring 属性时,出现错误。

我有一个这样定义的 HTTPS 连接器:

<mule xmlns:db="http://www.mulesoft.org/schema/mule/db"
        xmlns:core="http://www.mulesoft.org/schema/mule/core"
        xmlns:http="http://www.mulesoft.org/schema/mule/http"
        xmlns:https="http://www.mulesoft.org/schema/mule/https"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
        xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
        xmlns="http://www.mulesoft.org/schema/mule/core"
        xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
        xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.5.2"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper"
        xmlns:domain="http://www.mulesoft.org/schema/mule/ee/domain"
        xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/domain http://www.mulesoft.org/schema/mule/ee/domain/current/mule-domain-ee.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd">

...

        <https:connector name="HTTPSConnector" doc:name="HTTPS-Connector"
                cookieSpec="netscape" validateConnections="true" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0"
                clientSoTimeout="${service.timeout}" serverSoTimeout="60000" socketSoLinger="0">

                <spring:property name="sslType" value="TLSv1.2" />
        </https:connector>

...

骡子抛出错误:

org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'spring:property'. 
One of '{"http://www.mulesoft.org/schema/mule/core":service-overrides, "http://www.mulesoft.org/schema/mule/https":tls-client, "http://www.mulesoft.org/schema/mule/https":tls-key-store, "http://www.mulesoft.org/schema/mule/https":tls-server, "http://www.mulesoft.org/schema/mule/https":tls-protocol-handler}' is expected.

我需要进行哪些更改才能使此属性得到认可?

标签: mule

解决方案


如果您使用的是 3.5.2 版本,它对我来说没有问题。也许省略的片段中还有其他内容?如果<https:connector>在共享的片段中未显示元素内的其他配置,请确保`spring:property 是第一个。

请注意,即使它有效,您也可能会发现一些与 SSL 引擎和 Java SSL 支持相关的其他问题,以使其与 TLS 1.2 一起工作。例如 3.5.2 仅支持 Java 7。您可能会发现一些错误,在https://help.mulesoft.com/s/article/Setting-the-TLS-version-for-the-legacy-HTTPS-connector中提到。Mule 3.5 和 Java 7 都已报废。

如果您使用的是当前的 Mule 3 版本,建议将 Mule 3.9.5 作为当前最新和最好的版本,然后默认支持 TLS 1.2。与 Mule 4.x 相同。话虽如此,您使用的旧 HTTP 连接器已被弃用数年,建议使用新的 HTTP Listener/HTTP Requester 替代它。


推荐阅读