https4(Apache Camel 2.10.3) component option httpClientConfigurer for SSL is
not working when i have two different configure for two different route. we
need you help to resolve this issue or any alternate solution. Please let me
know if you have questions or need more information.
 


We are using httpClientConfigurer/httpClientConfigurerRef option as below to
register SSL Schema.


<route  id="route1">
  <from uri="direct:testTracingConfiguratorWithHttps4" />
  <to
uri="https4:///mydomin1/myservice1?httpClientConfigurerRef=Http4Configurator1"
/>
</route>


<route id="route2">
 <from uri="direct:testNonTracingConfiguratorWithHttps4" />
  <to
uri="https4:///mydomin2/myservice2?httpClientConfigurerRef=http4Configurator2"
/>
</route>

In http4Configurator1 and http4Configurator2 bean 
==============================

try{
ks = KeyStore.getInstance("JKS");
try {
System.out.println("-----------------Creating keystore----------------");
//       reloadedIs=new FileInputStream(keyPath + keyStorePath);
reloadedIs=new FileInputStream(keyPath);
ks.load(reloadedIs, keyPwd.toCharArray());
}
catch(Exception exc)
{
System.out.println("1---"+exc.getMessage());
exc.printStackTrace();
}
    ts = KeyStore.getInstance("JKS");
try {
System.out.println("-----------------Creating trust----------------");
//       tsreloadedIs=new FileInputStream(trustPath + trustStorePath);
tsreloadedIs=new FileInputStream(trustPath);
ts.load(tsreloadedIs, trustPwd.toCharArray());
}
catch(Exception exc)
{
System.out.println("2---"+exc.getMessage());
exc.printStackTrace();
}
}
catch(Exception exc)
{
System.out.println("3---"+exc.getMessage());
exc.printStackTrace();
}

try{
System.out.println("-----------------Creating Schema----------------");
KeyManagerFactory keyFactory = KeyManagerFactory.getInstance("SunX509");
    keyFactory.init(ks, keyPwd.toCharArray());
    TrustManagerFactory trustFactory =
TrustManagerFactory.getInstance("SunX509");
    trustFactory.init(ts);
    SSLContext sslcontext = SSLContext.getInstance("TLSv1");
    sslcontext.init(keyFactory.getKeyManagers(),
trustFactory.getTrustManagers(), null);

    System.out.println("-----------------SSL context
created----------------");
    SSLSocketFactory factory = new SSLSocketFactory(sslcontext);
    SchemeRegistry registry = new SchemeRegistry();
    //final Scheme scheme = new Scheme("https4", factory, 443);
    final Scheme scheme = new Scheme("https", 443, factory);
    registry.register(scheme);
client.getConnectionManager().getSchemeRegistry().register(scheme);
System.out.println("-----------------Schema Registry set---------------");
}
catch(Exception exc)
{
System.out.println("4---"+exc.getMessage());
exc.printStackTrace();
}



Per the camel documentation the endpoint specific "Ref" version of the
endpoint/component options are supposed to be "endpoint specific" overrides. 
So if one registers key & trust stores for one set of params to a scheme on
the client, it should NOT affect the other since it is an endpoint level
"override".

It appears,  like the SchemeRegistry is getting overwritten despite the
descriptions.

This CONTINUES to take effect even if you add two seperate beans for two
seperate ClientConnectionManager's via the "httpConnectionManager" endpoint
option, which only per the source of camel-http4 (2.10.3) appears to only be
parsed at the endpoint level.  Furthermore  using seperate "dummy" base
URL's and setting the actual target URL with the Exchange.HTTP_URI headers -
which makes the endpoints visibly distinct in Jconsole,  doesn't seem to
keep the "endpoint override" options in effect where they are supposed to
override.  




--
View this message in context: 
http://camel.465427.n5.nabble.com/https4-Apache-Camel-2-10-3-component-option-httpClientConfigurer-for-SSL-is-not-working-when-i-have-e-tp5731929.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to