0

在为监视操作编写camel-etcd root时如果我使用sslContextParameter作为OPTION参数最终出现以下错误

    SSLContextParameters sslContextParam = new SSLContextParameters();
    KeyStoreParameters keyStoreParam = new KeyStoreParameters();
    keyStoreParam.setResource(caCertFile);

    TrustManagersParameters trustMgr = new TrustManagersParameters();
    trustMgr.setKeyStore("\etcd-ca.crt");

    sslContextParam.setTrustManagers(trustMgr);
    sslContextParam.setSessionTimeout("10000");
     parentalRatingWatchRouteEndPoint = 
   "etcd:watch"+etcdHeaderPath+parentalRatingKey+"?recursive=true"+"&uris="+etcdRestEndPoint+"&sslContextParameter"+sslContextParam;

    from(parentalRatingWatchRouteEndPoint).startupOrder(2).autoStartup(true)
    .routeId(parentalRatingWatchRouteId)
    .onCompletion()

......

由于:找不到合适的属性设置器:sslContextParameters,因为没有具有相同类型的设置器方法:java.lang.String 也无法进行类型转换:没有可用于从类型转换的类型转换器:java.lang.String 到所需类型:org.apache.camel.util.jsse.SSLContextParameters,值为 SSLContextParameters[keyManagers=null, trustManagers=TrustManagerType[keyStore=KeyStoreParameters[type=null, password=********, provider=null,资源=etcd-ca.crt],提供者=null,算法=null],secureRandom=null,clientParameters=null,serverParameters=null,provider=null,secureSocketProtocol=null,certAlias=null,getCipherSuites()=null,getCipherSuitesFilter( )=null, getSecureSocketProtocols()=null, getSecureSocketProtocolsFilter()=null, getSessionTimeout()=10000]

etcd://watch/deployments/prod/config/parentalRatings/v1?recursive=true&sslContextParameters=SSLContextParameters%5BkeyManagers%3Dnull%2C+trustManagers%3DTrustManagerType%5BkeyStore%3DKeyStoreParameters%5Btype%3Dnull%2C+password%3D***** ***%2C+provider%3Dnull%2C+resource%3D%2Fetcd-ca.crt%5D%2C+provider%3Dnull%2C+算法%3Dnull%5D%2C+secureRandom%3Dnull%2C+clientParameters%3Dnull% 2C+serverParameters%3Dnull%2C+provider%3Dnull%2C+secureSocketProtocol%3Dnull%2C+certAlias%3Dnull%2C+getCipherSuites%28%29%3Dnull%2C+getCipherSuitesFilter%28%29%3Dnull%2C+getSecureSocketProtocols%28% 29%3Dnull%2C+getSecureSocketProtocolsFilter%28%29%3Dnull%2C+getSessionTimeout%28%29%3D10000%5D&uris=https%3A%2F%2Flocalhost%3A2379%2Fv2%2Fkeys

它必须使用 sslContextParameter 连接到 ETCD 服务器

4

1 回答 1

0

您需要将 ssl 密钥库放在骆驼注册表中并像“etcd:...&sslContextParameter=#yourSslContextParameter”一样引用它

于 2019-04-11T14:06:13.953 回答