[prev in list] [next in list] [prev in thread] [next in thread] 

List:       activemq-users
Subject:    Re: Unable to connect when trying to use mqtt
From:       Timothy Bish <tabish121 () gmail ! com>
Date:       2014-04-29 13:34:50
Message-ID: 535FAA7A.30807 () gmail ! com
[Download RAW message or body]

On 04/28/2014 05:34 PM, karcel wrote:
> Hi!
> 
> I am quite new in here and i got problem connecting to localhost while using
> mqtt.
> 
> With usingn defaults:
> 
> private static String url = ActiveMQConnection.DEFAULT_BROKER_URL;
> 
> ConnectionFactory connectionFactory =new
> ActiveMQConnectionFactory(url);
> Connection connection = connectionFactory.createConnection();
> connection.start();
> 
> I assume, it is using AMQP protocol as defaults. Now i would like to use
> mqtt.
> Since I am using activemq v5.9.1. there should be possibility to do so.
> 
> I tried this:
> 
> private static String uri = "failover://mqtt://primary:1883";
> 
> ConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory(uri);
> Connection connection = connectionFactory.createConnection();
> connection.start();
> 
> In xml file i have: <transportConnector name="mqtt"
> uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
>  
> Always is comes with errors:
> 
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/fusesource/mqtt/codec/PINGRESP
> 	at
> org.apache.activemq.transport.mqtt.MQTTProtocolConverter.<clinit>(MQTTProtocolConverter.java:87)
>   at
> org.apache.activemq.transport.mqtt.MQTTTransportFilter.<init>(MQTTTransportFilter.java:55)
>   at
> org.apache.activemq.transport.mqtt.MQTTTransportFactory.compositeConfigure(MQTTTransportFactory.java:57)
>   at
> org.apache.activemq.transport.TransportFactory.configure(TransportFactory.java:224)
> 	at
> org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:120)
> 	at
> org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:64)
> 	at
> org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:315)
>   at
> org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:330)
>   at
> org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:303)
>   at
> org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:243)
>   at BenchMQTT.Test_A_1.main(Test_A_1.java:35)
> Caused by: java.lang.ClassNotFoundException:
> org.fusesource.mqtt.codec.PINGRESP
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> 	... 11 more
> 
> Any help?
> 
> 
> 
> --
> View this message in context: \
> http://activemq.2283324.n4.nabble.com/Unable-to-connect-when-trying-to-use-mqtt-tp4680645.html
>  Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> 
ActiveMQConnectionFactory will create a client that speaks OpenWire 
only.  If you want to speak MQTT you need to use an MQTT client.  If you 
want AMQP you need to use an AMQP client, one such client would be the 
QPid JMS client for AMQP 1.0.  There are several MQTT clients out there, 
although none that map MQTT to JMS from what I've seen as that would be 
something that doesn't really make to much sense given MQTT's restrained 
feature-set.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic