Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9BA6611D3D for ; Thu, 4 Sep 2014 09:38:20 +0000 (UTC) Received: (qmail 97475 invoked by uid 500); 4 Sep 2014 09:38:10 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 97446 invoked by uid 500); 4 Sep 2014 09:38:10 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 97413 invoked by uid 99); 4 Sep 2014 09:38:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Sep 2014 09:38:09 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jimmidyson@gmail.com designates 209.85.217.175 as permitted sender) Received: from [209.85.217.175] (HELO mail-lb0-f175.google.com) (209.85.217.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Sep 2014 09:38:05 +0000 Received: by mail-lb0-f175.google.com with SMTP id u10so11306139lbd.34 for ; Thu, 04 Sep 2014 02:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=78RgO6Vxfu2q1OTkwsoqvif2lJbr+VcltZvs7/H3fDo=; b=yeQjwgdVwjX6AxDdNDXBLKsv36SvpDMo1dvzt3RxfElYC4P7PpsSDuX+ogpSqXSpNa lkMSiCJN36yiBZUtPwoShPXkJeAQsloJttILbPKDPOKTsOd0h7S6WJtboaPydFZeh7Fk JLKlYT5KJixCYD7GoSyKc/FEaYexm04wFpZC3HBjRLZx8eNFPlM9dw1LSd4li5XaZT2s qOZxJ4jZvbGN5Rsgj2EE503nF45Uje0gM5/jSlcTW7t1CaCBRmKgODkU5MSJzDMd/lWI 8Gi4Z1gAOJv7JLMEJEFRs5SUuxqdVRkstmMQM7k1r9QMG6Lo9x3HDRaVdtqiUWq7a9hH kehg== MIME-Version: 1.0 X-Received: by 10.112.35.138 with SMTP id h10mr2954565lbj.65.1409823463726; Thu, 04 Sep 2014 02:37:43 -0700 (PDT) Received: by 10.25.25.6 with HTTP; Thu, 4 Sep 2014 02:37:43 -0700 (PDT) In-Reply-To: References: Date: Thu, 4 Sep 2014 10:37:43 +0100 Message-ID: Subject: Re: How to Enable SSL on Camel MQTT component From: Jimmi Dyson To: users@camel.apache.org Content-Type: multipart/alternative; boundary=001a11c372bcc0664405023a1a59 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c372bcc0664405023a1a59 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks Gang, both for the letting us know what the problem turned out to be & for the cultural lesson - I will remember for next time :) On 4 September 2014 10:30, clever <191008990@qq.com> wrote: > Hi Jimmi: > > > Actually, it's my fault , I used a wrong protocol "ssl" instead of > "mqtt+ssl" in Activemq configuration. > > > you can call my Gang, Liu is my family name. In China, we always put the > family name as the first name, which opposite with you. > > > Anyway, Thanks a lot. > > > GangLiu > ------------------ =E5=8E=9F=E5=A7=8B=E9=82=AE=E4=BB=B6 -----------------= - > =E5=8F=91=E4=BB=B6=E4=BA=BA: "Jimmi Dyson";; > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2014=E5=B9=B49=E6=9C=883=E6=97=A5(= =E6=98=9F=E6=9C=9F=E4=B8=89) =E4=B8=8B=E5=8D=884:27 > =E6=94=B6=E4=BB=B6=E4=BA=BA: "users"; > > =E4=B8=BB=E9=A2=98: Re: How to Enable SSL on Camel MQTT component > > > > Hi Liu - would you mind sharing what the problem/solution was to help > others that may hit it in future? > > Thanks, > Jimmi > > > On 3 September 2014 04:11, liu gang wrote: > > > OK, it works now, thanks you all > > > > > > 2014-09-03 9:19 GMT+08:00 clever <191008990@qq.com>: > > > > > Hi Jimmi: > > > > > > > > > Thank you very much. I'll check your example and try again. > > > > > > > > > Thanks. > > > > > > > > > > > > > > > ------------------ =E5=8E=9F=E5=A7=8B=E9=82=AE=E4=BB=B6 -------------= ----- > > > =E5=8F=91=E4=BB=B6=E4=BA=BA: "Jimmi Dyson";; > > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2014=E5=B9=B49=E6=9C=882=E6=97= =A5(=E6=98=9F=E6=9C=9F=E4=BA=8C) =E6=99=9A=E4=B8=8A10:21 > > > =E6=94=B6=E4=BB=B6=E4=BA=BA: "users"; > > > > > > =E4=B8=BB=E9=A2=98: Re: How to Enable SSL on Camel MQTT component > > > > > > > > > > > > Hi, > > > > > > Is the ActiveMQ (I'm assuming you're using ActiveMQ!) MQTT transport > > > connector configured to listen on 61617? Are you sure that's not a > > non-MQTT > > > (perhaps SSL-configured Openwire) transport connector on 61617? FYI > there > > > is a IANA port reserved (8883) for MQTT over SSL, although of course > you > > > can use whatever port you want. > > > > > > Make sure you've set > > > "-Djavax.net.ssl.trustStore=3D > > > -Djavax.net.ssl.trustStorePassword=3D" > > > correctly if you're using a self-signed server certificate or your ow= n > CA > > > for issuing the server certificate. If you're using a public CA then > this > > > shouldn't be necessary. > > > > > > I've pushed an example with some tests including ActiveMQ > SSL-configured > > > test with self-signed cert to > > > https://github.com/jimmidyson/camel-examples/tree/master/activemq-mqt= t > . > > > > > > Jimmi > > > > > > > > > On 2 September 2014 12:04, Charles Moulliard wrote= : > > > > > > > Hi, > > > > > > > > I think that debugging will be required as you get a message type = =3D 0 > > > (see > > > > code here : > > > > > > > > > > > > > > https://github.com/fusesource/mqtt-client/blob/master/mqtt-client/src/mai= n/java/org/fusesource/mqtt/client/CallbackConnection.java#L335 > > > > ) > > > > As you have configured your ActiveMQ Transport connector to use MQT= T > + > > > SSL, > > > > I assume that it has been configured like that ? > > > > http://rijware.com/securing-mqtt-on-apache-activemq/ > > > > > > > > Regards, > > > > > > > > > > > > > > > > On Tue, Sep 2, 2014 at 10:57 AM, clever <191008990@qq.com> wrote: > > > > > > > > > I saw the page of http://camel.apache.org/mqtt.html said mqtt > > > component > > > > > supports to use ssl connection. but didn't mention how to enable > it. > > > > > > > > > > > > > > > I tried to change the protocol to ssl, and also set the system > > > > properties: > > > > > > > > > > > > > > > > > > > > javax.net.ssl.keyStore/javax.net.ssl.keyStorePassword/javax.net.ssl.Trust= Store=E2=80=8D=E2=80=8D=E2=80=8D > > > > > > > > > > > > > > > Besides, I also tried to set a customized SSLContext to > > > MQTTConfiguration > > > > > . both of them don't work.=E2=80=8D > > > > > > > > > > > > > > > The error looks like: > > > > > Exception in thread "main" > > > org.apache.camel.FailedToCreateRouteException: > > > > > Failed to create route route1: > > > > > Route(route1)[[From[mqtt:bar?host=3Dssl://localhost:61617]] ->... > > because > > > > of > > > > > Failed to resolve endpoint: > > > mqtt://bar?host=3Dssl%3A%2F%2Flocalhost%3A61617 > > > > > due to: Could not connect. Received unexpected command: 0 > > > > > at > > > > > > > > > > > > > > > org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:180= ) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.= java:780) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCa= melContext.java:2068) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContex= t.java:1816) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.jav= a:1683) > > > > > at > > > > > > org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:= 1651) > > > > > at > > > > > > > org.apache.activemq.book.ch3.TestCamelMQTT.main(TestCamelMQTT.java:70) > > > > > Caused by: org.apache.camel.ResolveEndpointFailedException: Faile= d > to > > > > > resolve endpoint: mqtt://bar?host=3Dssl%3A%2F%2Flocalhost%3A61617= due > > to: > > > > > Could not connect. Received unexpected command: 0 > > > > > at > > > > > > > > > > > > > > > org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext= .java:534) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContex= tHelper.java:71) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.ja= va:190) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteCon= text.java:106) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteCon= text.java:112) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java= :72) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext= .java:88) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:888= ) > > > > > at > > > > > > > > > > > > > > > org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:175= ) > > > > > ... 7 more > > > > > Caused by: java.io.IOException: Could not connect. Received > > unexpected > > > > > command: 0 > > > > > at > > > > > > > > > > > > > > > org.fusesource.mqtt.client.CallbackConnection$LoginHandler$1.onTransportC= ommand(CallbackConnection.java:338) > > > > > at > > > > > > > > > > > > > > > org.fusesource.hawtdispatch.transport.TcpTransport.drainInbound(TcpTransp= ort.java:713) > > > > > at > > > > > > > > > > > > > > > org.fusesource.hawtdispatch.transport.SslTransport.handshake(SslTransport= .java:452) > > > > > at > > > > > > > > > > > > > > > org.fusesource.hawtdispatch.transport.SslTransport.drainInbound(SslTransp= ort.java:274) > > > > > at > > > > > > > > > > > > > > > org.fusesource.hawtdispatch.transport.TcpTransport$6.run(TcpTransport.jav= a:592) > > > > > at > > > > > > > > > > > > > > > org.fusesource.hawtdispatch.internal.NioDispatchSource$3.run(NioDispatchS= ource.java:209) > > > > > at > > > > > > > > > > > > > > > org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispat= chQueue.java:100) > > > > > at > > > > > > > > > > > > > > > org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.j= ava:77) > > > > > > > > > > =E2=80=8D > > > > > > > > > > > > > > > > > > > > I tried the way on a plain Java App by using > > > ActiveMQSslConnectionFactory > > > > > to connect to it, it works to read message from/write message to > > > > Activemq. > > > > > > > > > > > > > > > I used Activemq 5.10 with ssl transport enabled as Server side. = =E2=80=8D > > > > > > > > > > > > > > > I appreciate if anybody can give me some hints. > > > > > > > > > > > > > > > Thanks in advance. > > > > > > > > > > > > > > > > > > > > -- > > > > Charles Moulliard > > > > Apache Committer / Architect @RedHat > > > > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io > > > > > > > > > > > > > > > -- > > Best Regards > > GangLiu > > Mail: clevers594@gmail.com > > --001a11c372bcc0664405023a1a59--