Apache camel https4 apache camel提供的主机名与对等方提供的证书主题不匹配

Apache camel https4 apache camel提供的主机名与对等方提供的证书主题不匹配,apache-camel,apache-servicemix,spring-dsl,Apache Camel,Apache Servicemix,Spring Dsl,我正在尝试在SpringDSL中与ApacheCamel建立https连接。遵循本教程: 而且: 我构建了以下代码: <sslContextParameters id="sslContextParameters" xmlns="http://camel.apache.org/schema/blueprint"> <trustManagers> <keyStore resource="keyStore/keyStore.jks

我正在尝试在SpringDSL中与ApacheCamel建立https连接。遵循本教程:

而且:

我构建了以下代码:

<sslContextParameters id="sslContextParameters" xmlns="http://camel.apache.org/schema/blueprint"> 
        <trustManagers>
            <keyStore resource="keyStore/keyStore.jks" password="changeit"/>                   
        </trustManagers>                
</sslContextParameters>

现在我可以在证书中看到这个主机名没有在主题中定义。我看到证书无法编辑,所以我的问题是如何调整此代码,使其读取正确的主机名?

这是基于可用信息的猜测,但请尝试一下。 您的证书CN是
axis-accc8ec51452
您应该连接到此主机名,而不是
my\u ip\u address


要将主机名
axis-accc8ec51452
映射到
myip\u地址
,请在DNS解析程序中更新主机名或将其添加到主机名文件(*nix:
/etc/hosts
;Windows:
c:\Windows\System32\Drivers\etc\hosts

这非常令人沮丧,但是在@ShellDragon的帮助下,我搜索了一个允许所有主机名的bean。这个bean是x509HostnameVerifier。因此,在我的代码中,我在这里添加了以下内容:

<bean id="http-ssl" class="org.apache.camel.component.http4.HttpComponent">
    <property name="sslContextParameters" ref="sslContextParameters"/>
      <property name="x509HostnameVerifier" ref = "x509HostnameVerifier"/>
    </bean>
<bean id="http-ssl" class="org.apache.camel.component.http4.HttpComponent">
<property name="sslContextParameters" ref="sslContextParameters"/>
</bean>
javax.net.ssl.SSLPeerUnverifiedException: Host name my_ip_adress does not 
match the certificate subject provided by the peer (CN=axis-accc8ec51452, 
O=Axis Communications AB)
<bean id="http-ssl" class="org.apache.camel.component.http4.HttpComponent">
    <property name="sslContextParameters" ref="sslContextParameters"/>
      <property name="x509HostnameVerifier" ref = "x509HostnameVerifier"/>
    </bean>
https4://my_ip_adress?sslContextParametersRef=sslContextParameters&amp;x509HostnameVerifier=x509HostnameVerifier