You need to use the # for the parameter like this:

 
.to("https4://<IP_ADDRESS>:<PORT_NUMBER>/MutualAuthentication/MutuallySecuredServlet?sslContextParameters=#sslContextParameters");

--
Andrea Cosentino 
----------------------------------
Apache Camel PMC Chair
Apache Karaf Committer
Apache Servicemix PMC Member
Email: ancosen1...@yahoo.com
Twitter: @oscerd2
Github: oscerd






On Friday, March 29, 2019, 1:20:47 PM GMT+1, Rohan Emmanuel 
<rohan.emmanue...@gmail.com> wrote: 





The full route is as follows

   RouteBuilder routeBuilder = new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("netty4:tcp://127.0.0.1:9992?allowDefaultCodec=false")
                .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.GET))
                        
.to("https4://<IP_ADDRESS>:<PORT_NUMBER>/MutualAuthentication/MutuallySecuredServlet?sslContextParameters=sslContextParameters");
            }
        };

On Fri, Mar 29, 2019 at 5:43 PM Andrea Cosentino 
<ancosen1...@yahoo.com.invalid> wrote:
> Can you show the full route?
> 
> --
> Andrea Cosentino 
> ----------------------------------
> Apache Camel PMC Chair
> Apache Karaf Committer
> Apache Servicemix PMC Member
> Email: ancosen1...@yahoo.com
> Twitter: @oscerd2
> Github: oscerd
> 
> 
> 
> 
> 
> 
> On Friday, March 29, 2019, 1:02:08 PM GMT+1, Rohan Emmanuel 
> <rohan.emmanue...@gmail.com> wrote: 
> 
> 
> 
> 
> 
> Thanks for the response Andrea, 
> 
> i do have set the sslContextParameters as follows, do you see anything wrong 
> with it?
> 
> 
> ksp.setResource("C:\\gateway\\conf\\server.keystore");
>         ksp.setType("pkcs12");
>         ksp.setPassword("changeit");
> 
>         KeyManagersParameters kmp = new KeyManagersParameters();
>         kmp.setKeyStore(ksp);
>         kmp.setKeyPassword("changeit");
> 
>         TrustManagersParameters tmp = new TrustManagersParameters();
>         tmp.setKeyStore(ksp);
> 
>         SSLContextParameters scp = new SSLContextParameters();
>         
>         
>         
>         scp.setKeyManagers(kmp);
>         scp.setTrustManagers(tmp);
>         
>         JndiRegistry reg = new JndiRegistry(new JndiContext());
> 
>         reg.bind("sslContextParameters",scp);
>         
>         CamelContext context = new DefaultCamelContext(reg);
>           routeBuilder.addRoutesToCamelContext(context);
>  context.start();
> 
> 
> 
> On Fri, Mar 29, 2019 at 5:14 PM Andrea Cosentino 
> <ancosen1...@yahoo.com.invalid> wrote:
>> You need to set the sslContextParameters on your uri.
>> 
>> https://github.com/apache/camel/blob/master/components/camel-http4/src/main/docs/http4-component.adoc
>> 
>> --
>> Andrea Cosentino 
>> ----------------------------------
>> Apache Camel PMC Chair
>> Apache Karaf Committer
>> Apache Servicemix PMC Member
>> Email: ancosen1...@yahoo.com
>> Twitter: @oscerd2
>> Github: oscerd
>> 
>> 
>> 
>> 
>> 
>> 
>> On Friday, March 29, 2019, 12:40:18 PM GMT+1, Rohan Emmanuel 
>> <rohan.emmanue...@gmail.com> wrote: 
>> 
>> 
>> 
>> 
>> 
>> hi ,
>> I am trying to establish HTTPS connection to webserver in a route( running
>> as standalone java application). but i am getting handshake exception can
>> you please point me in the right direction?
>> 
>> any http4s sample which i can use?
>> 
>> below is the stack trace.
>> 1.)I imported the client key store in browser and i am able to connect to
>> the webserver to invoke the web application.
>> 2.) when i try to connect to the same applciation in route, i get the below
>> exception.
>> 
>> 
>> 
>> Message History
>> ---------------------------------------------------------------------------------------------------------------------------------------
>> RouteId              ProcessorId          Processor
>>                                                 Elapsed (ms)
>> [route1            ] [route1            ] [tcp://127.0.0.1:9992
>>                                               ] [      1253]
>> [route1            ] [setHeader1        ] [setHeader[CamelHttpMethod]
>>                                               ] [        10]
>> [route1            ] [to1              ] [https4://
>> 15.213.85.104:3110/MutualAuthentication/MutuallySecuredServlet?sslCon] [
>>   1228]
>> 
>> Stacktrace
>> ---------------------------------------------------------------------------------------------------------------------------------------
>> javax.net.ssl.SSLHandshakeException: Remote host closed connection during
>> handshake
>> at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:992)
>> ~[?:1.8.0_101]
>> at
>> sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
>> ~[?:1.8.0_101]
>> at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
>> ~[?:1.8.0_101]
>> at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
>> ~[?:1.8.0_101]
>> at
>> org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:396)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> at
>> org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:355)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> at
>> org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> at
>> org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> at
>> org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> at
>> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> at
>> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> at
>> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> at
>> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
>> ~[httpclient-4.5.3.jar:4.5.3]
>> 
>> 
>> 
>> -- 
>> Regards,
>> Rohan Emmanuel
>> 
> 
> 
> -- 
> Regards,
> Rohan Emmanuel
> 


-- 
Regards,
Rohan Emmanuel

Reply via email to