In http://stackoverflow.com/questions/33508706/activemq-protocolexception-invalid-connect-encoding, Tim Bish mentioned a couple of possible things that could result in this error (though the possibilities were all very generic, so I'd be surprised if they led you to the answer on their own), and he also gave a suggestion for a Log4J configuration change that might provide additional information.
If the Log4J change doesn't provide anything useful, you could attach a debugger to the broker, set a breakpoint at the log line you quoted (or at appropriate points upstream from it), and step through the code to see what it is about the content your client is sending that the broker doesn't like. If it was me, I'd just skip right to this option rather than messing with the Log4J config, but the choice is yours. Tim On May 11, 2017 6:54 AM, "aragoubi" <aymen....@gmail.com> wrote: > I have an embedded activeMQ broker listening to two ports. > > Here's my broker-config file : > > <?xml version="1.0" encoding="UTF-8"?> > <beans > xmlns="http://www.springframework.org/schema/beans" > xmlns:amq="http://activemq.apache.org/schema/core" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd > http://activemq.apache.org/schema/core > http://activemq.apache.org/schema/core/activemq-core.xsd"> > > > <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" > useShutdownHook="false" brokerName="mimo.broker1"> > > <managementContext> > <managementContext createConnector="false"/> > </managementContext> > <systemUsage> > <systemUsage> > <memoryUsage> > <memoryUsage limit="64 mb"/> > </memoryUsage> > <storeUsage> > <storeUsage limit="100 gb"/> > </storeUsage> > <tempUsage> > <tempUsage limit="50 gb"/> > </tempUsage> > </systemUsage> > </systemUsage> > <persistenceAdapter> > <kahaDB directory="activemq-data/kahadb"/> > </persistenceAdapter> > <transportConnectors> > <transportConnector name="mimo.broker1" uri="tcp://0.0.0.0:61616" /> > <transportConnector name="mqtt+ws" uri="ws://0.0.0.0:1884"/> > </transportConnectors> > > </broker> > </beans> > > When I launch my jboss server I see that the broker is launched and > listening to ports: > > 11:00:33,792 INFO > [org.apache.activemq.transport.TransportServerThreadSupport] (Starting > ActiveMQ Broker) Listening for connections at: tcp://DESKTOP-4D80FU1:61616 > 11:00:33,793 INFO [org.apache.activemq.broker.TransportConnector] > (Starting > ActiveMQ Broker) Connector mimo.broker1 started > 11:00:33,849 INFO [org.eclipse.jetty.server.Server] (Starting ActiveMQ > Broker) jetty-7.6.9.v20130131 > 11:00:33,876 INFO [org.eclipse.jetty.server.handler.ContextHandler] > (Starting ActiveMQ Broker) started o.e.j.s.ServletContextHandler{/,null} > 11:00:33,905 INFO [org.eclipse.jetty.server.AbstractConnector] (Starting > ActiveMQ Broker) Started SelectChannelConnector@0.0.0.0:1884 > 11:00:33,906 INFO [org.apache.activemq.transport.ws.WSTransportServer] > (Starting ActiveMQ Broker) Listening for connections at > ws://DESKTOP-4D80FU1:1884 > 11:00:33,907 INFO [org.apache.activemq.broker.TransportConnector] > (Starting > ActiveMQ Broker) Connector mqtt+ws started > 11:00:33,908 INFO [org.apache.activemq.broker.BrokerService] (Starting > ActiveMQ Broker) Apache ActiveMQ 5.9.0 (mimo.broker1, > ID:DESKTOP-4D80FU1-57645-1494493233653-0:1) started > 11:00:33,909 INFO [org.apache.activemq.broker.BrokerService] (Starting > ActiveMQ Broker) For help or more information please see: > http://activemq.apache.org > > I tried a mqtt client using java paho mqttv3, this is how I tried to > connect > to my broker: > > String broker = "ws://127.0.0.1:1883"; > String clientId = "JavaSample"; > MemoryPersistence persistence = new MemoryPersistence(); > try { > MqttAsyncClient sampleClient = new MqttAsyncClient(broker, > clientId, persistence); > MqttConnectOptions connOpts = new MqttConnectOptions(); > connOpts.setCleanSession(true); > connOpts.setAutomaticReconnect(true); > IMqttToken token = sampleClient.connect(connOpts); > }catch(MqttException e){ > e.printStackTrace(); > } > > My problem is that the connection is never getting established with the > broker. > I am getting this warn when I try to connect to broker "[WARN > [org.apache.activemq.broker.TransportConnection.Transport] > (qtp906254668-147) Transport Connection to: MQTTSocket_248153872 failed: > java.io.IOException: Invalid CONNECT encoding". > > I tried to connect to mosquitto remote broker > "tcp://test.mosquitto.org:1883" and it works. > Could someone help me with this? Is this an activeMQ configuration problem? > > > > -- > View this message in context: http://activemq.2283324.n4. > nabble.com/WARN-org-apache-activemq-broker-TransportConnection-Transport- > qtp906254668-147-Transport-Connection-g-tp4725962.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. >