You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Rafa Ruiz <ra...@gmail.com> on 2017/06/12 10:43:46 UTC

Camel MQTT component fails when set sslContext

Hello:
I am trying to connect to a activemq broker within Openshift through MQTT +
SSL
My route is calling to activemq like this:

<to id="put-msg-mqtt"
uri="mqtt:mqtt-queue?host=ssl://mqtt-ssl-amq-ssl.openshift.example.com:443&amp;userName=admin&amp;password=admin&amp;connectWaitInSeconds=3&amp;publishTopicName=mqtt-topic&amp;sslContext=mySSLContextParameters"/>


and I have previously configured needed sslContext:

<camel:sslContextParameters id="mySSLContextParameters">
        <camel:keyManagers keyPassword="changeme">
            <camel:keyStore password="changeme"
resource="/tmp/amq-client.jks"/>
        </camel:keyManagers>
        <camel:trustManagers>
            <camel:keyStore password="changeme"
resource="/tmp/amq-client.jks"/>
        </camel:trustManagers>
        <camel:serverParameters clientAuthentication="NONE"/>
    </camel:sslContextParameters>

If I set these cert. managers with
-Djavax.net.ssl.keyStore=/tmp/amq-client.jks
-Djavax.net.ssl.keyStorePassword=changeme
-Djavax.net.ssl.trustStore=/tmp/amq-client.jks
-Djavax.net.ssl.trustStorePassword=changeme
It works.


But with camel:sslContextParameters I have an exception in my camel route:

"Could not find a suitable setter for property: sslContext as there isn't a
setter method with same type: java.lang.String nor type conversion
possible: No type converter available to convert from type:
java.lang.String to the required type: javax.net.ssl.SSLContext with value
mySSLContextParameters
at
org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:590)
    at
org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:616)
    at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:473)
    at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:483)
    at
org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:260)
    at
org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:267)
    at
org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:255)
    at
org.apache.camel.component.mqtt.MQTTComponent.createEndpoint(MQTTComponent.java:50)
.....
"

I thought that class org.apache.camel.component.mqtt.MQTTConfiguration.java
does not manage correctly converting from a String reference to SSLContext
Or am I doing something wrong?
Thanks in advance

Re: Camel MQTT component fails when set sslContext

Posted by Rafa Ruiz <ra...@gmail.com>.
Thanks Claus. But same result:
"Could not find a suitable setter for property: sslContext as there isn't a
setter method with same type: java.lang.String nor type conversion
possible: No type converter available to convert from type:
java.lang.String to the required type: javax.net.ssl.SSLContext with value
#mySSLContextParameters"

In published docs (https://camel.apache.org/mqtt.html) there is no mention
to sslContext parameter of the endpoint. But in github non-published docs,
it appears:
https://github.com/apache/camel/blob/apache-master/components/camel-mqtt/src/main/docs/mqtt-component.adoc

Is -D properties the only way?

2017-06-12 15:05 GMT+02:00 Claus Ibsen <cl...@gmail.com>:

> Use # notation when you refer to a bean from the registry. See more
> details at:
> http://camel.apache.org/how-do-i-configure-endpoints.html
>
> eg sslContext=#mySSLContextParameters
>
> On Mon, Jun 12, 2017 at 12:43 PM, Rafa Ruiz <ra...@gmail.com> wrote:
> > Hello:
> > I am trying to connect to a activemq broker within Openshift through
> MQTT +
> > SSL
> > My route is calling to activemq like this:
> >
> > <to id="put-msg-mqtt"
> > uri="mqtt:mqtt-queue?host=ssl://mqtt-ssl-amq-ssl.openshift.
> example.com:443&amp;userName=admin&amp;password=admin&amp;
> connectWaitInSeconds=3&amp;publishTopicName=mqtt-topic&amp;sslContext=
> mySSLContextParameters"/>
> >
> >
> > and I have previously configured needed sslContext:
> >
> > <camel:sslContextParameters id="mySSLContextParameters">
> >         <camel:keyManagers keyPassword="changeme">
> >             <camel:keyStore password="changeme"
> > resource="/tmp/amq-client.jks"/>
> >         </camel:keyManagers>
> >         <camel:trustManagers>
> >             <camel:keyStore password="changeme"
> > resource="/tmp/amq-client.jks"/>
> >         </camel:trustManagers>
> >         <camel:serverParameters clientAuthentication="NONE"/>
> >     </camel:sslContextParameters>
> >
> > If I set these cert. managers with
> > -Djavax.net.ssl.keyStore=/tmp/amq-client.jks
> > -Djavax.net.ssl.keyStorePassword=changeme
> > -Djavax.net.ssl.trustStore=/tmp/amq-client.jks
> > -Djavax.net.ssl.trustStorePassword=changeme
> > It works.
> >
> >
> > But with camel:sslContextParameters I have an exception in my camel
> route:
> >
> > "Could not find a suitable setter for property: sslContext as there
> isn't a
> > setter method with same type: java.lang.String nor type conversion
> > possible: No type converter available to convert from type:
> > java.lang.String to the required type: javax.net.ssl.SSLContext with
> value
> > mySSLContextParameters
> > at
> > org.apache.camel.util.IntrospectionSupport.setProperty(
> IntrospectionSupport.java:590)
> >     at
> > org.apache.camel.util.IntrospectionSupport.setProperty(
> IntrospectionSupport.java:616)
> >     at
> > org.apache.camel.util.IntrospectionSupport.setProperties(
> IntrospectionSupport.java:473)
> >     at
> > org.apache.camel.util.IntrospectionSupport.setProperties(
> IntrospectionSupport.java:483)
> >     at
> > org.apache.camel.util.EndpointHelper.setProperties(
> EndpointHelper.java:260)
> >     at
> > org.apache.camel.impl.DefaultComponent.setProperties(
> DefaultComponent.java:267)
> >     at
> > org.apache.camel.impl.DefaultComponent.setProperties(
> DefaultComponent.java:255)
> >     at
> > org.apache.camel.component.mqtt.MQTTComponent.
> createEndpoint(MQTTComponent.java:50)
> > .....
> > "
> >
> > I thought that class org.apache.camel.component.
> mqtt.MQTTConfiguration.java
> > does not manage correctly converting from a String reference to
> SSLContext
> > Or am I doing something wrong?
> > Thanks in advance
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Re: Camel MQTT component fails when set sslContext

Posted by Claus Ibsen <cl...@gmail.com>.
Use # notation when you refer to a bean from the registry. See more details at:
http://camel.apache.org/how-do-i-configure-endpoints.html

eg sslContext=#mySSLContextParameters

On Mon, Jun 12, 2017 at 12:43 PM, Rafa Ruiz <ra...@gmail.com> wrote:
> Hello:
> I am trying to connect to a activemq broker within Openshift through MQTT +
> SSL
> My route is calling to activemq like this:
>
> <to id="put-msg-mqtt"
> uri="mqtt:mqtt-queue?host=ssl://mqtt-ssl-amq-ssl.openshift.example.com:443&amp;userName=admin&amp;password=admin&amp;connectWaitInSeconds=3&amp;publishTopicName=mqtt-topic&amp;sslContext=mySSLContextParameters"/>
>
>
> and I have previously configured needed sslContext:
>
> <camel:sslContextParameters id="mySSLContextParameters">
>         <camel:keyManagers keyPassword="changeme">
>             <camel:keyStore password="changeme"
> resource="/tmp/amq-client.jks"/>
>         </camel:keyManagers>
>         <camel:trustManagers>
>             <camel:keyStore password="changeme"
> resource="/tmp/amq-client.jks"/>
>         </camel:trustManagers>
>         <camel:serverParameters clientAuthentication="NONE"/>
>     </camel:sslContextParameters>
>
> If I set these cert. managers with
> -Djavax.net.ssl.keyStore=/tmp/amq-client.jks
> -Djavax.net.ssl.keyStorePassword=changeme
> -Djavax.net.ssl.trustStore=/tmp/amq-client.jks
> -Djavax.net.ssl.trustStorePassword=changeme
> It works.
>
>
> But with camel:sslContextParameters I have an exception in my camel route:
>
> "Could not find a suitable setter for property: sslContext as there isn't a
> setter method with same type: java.lang.String nor type conversion
> possible: No type converter available to convert from type:
> java.lang.String to the required type: javax.net.ssl.SSLContext with value
> mySSLContextParameters
> at
> org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:590)
>     at
> org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:616)
>     at
> org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:473)
>     at
> org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:483)
>     at
> org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:260)
>     at
> org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:267)
>     at
> org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:255)
>     at
> org.apache.camel.component.mqtt.MQTTComponent.createEndpoint(MQTTComponent.java:50)
> .....
> "
>
> I thought that class org.apache.camel.component.mqtt.MQTTConfiguration.java
> does not manage correctly converting from a String reference to SSLContext
> Or am I doing something wrong?
> Thanks in advance



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2