在为监视操作编写camel-etcd根时,如果我使用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到所需的类型:值为SSLContextParameters [keyManagers = null,trustManagers = TrustManagerType [keyStore = KeyStoreParameters [type = null,password = ********,提供者]的org.apache.camel.util.jsse.SSLContextParameters = null,resource = etcd-ca.crt],provider = null,algorithm = 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 +提供者%3Dnull%2C +资源%3D%2Fetcd-ca.crt%5D%2C +提供者%3Dnull%2C +算法%3Dnull%5D%2C + secureRandom%3Dnull%2C + clientParameters %3Dnull%2C +服务器参数%3Dnull%2C +提供者%3Dnull%2C + secureSocketProtocol%3Dnull%2C + certAlias%3Dnull%2C + getCipherSuites%28%29%3Dnull%2C + getCipherSuitesFilter%28%29%3DnulleSocketsPro %28%29%3Dnull%2C + getSecureSocketProtocolsFilter%28%29%3Dnull%2C + getSessionTimeout%28%29%3D10000%5D&uris = https%3A%2F%2Flocalhost%3A2379%2Fv2%2Fkeys
它必须使用sslContextParameter连接到ETCD服务器
答案 0 :(得分:0)
您需要将ssl密钥库放入骆驼注册表中,并像“ etcd:...&sslContextParameter =#yourSslContextParameter”一样引用它