Do those errors occur on the client or the broker? Are there any relevant
lines in the other one's log?

This has been previously seen at least once (
https://stackoverflow.com/questions/27768919/in-my-activemq-config-i-have-problems-with-the-udp-and-http-protocols),
but there was apparently no resolution then. Do your symptoms match the
ones in that post (including the fact that there is no indication that the
HTTP listener was started? If so, can you increase the broker's logging
level to DEBUG and see if there is any indication of why the listener is
not starting?

Tim

On Nov 15, 2017 7:27 AM, "patrick_leon" <llccb...@hotmail.com> wrote:

Hi Guys,

I am trying to use ActiveMQ with HTTP transport. After setting up the
broker, when I tried to send msgs and I got the following exceptions: After
debugging, the exception occured during "connection.start()".

Thanks a lot in advance

The apache-activemq-5.9.0 is used. I have HTTPclient and XStream jar loaded.

<http://activemq.2283324.n4.nabble.com/file/t378779/activemqJars.jpg>
Exception in thread "ActiveMQ Transport: HTTP Reader
http://10.30.101.60:61610"; com.thoughtworks.xstream.io.StreamException:  :
input contained no data
        at
com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:126)
        at
com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(
AbstractPullReader.java:148)
        at
com.thoughtworks.xstream.io.xml.AbstractPullReader.
readEvent(AbstractPullReader.java:141)
        at
com.thoughtworks.xstream.io.xml.AbstractPullReader.move(
AbstractPullReader.java:118)
        at
com.thoughtworks.xstream.io.xml.AbstractPullReader.
moveDown(AbstractPullReader.java:103)
        at com.thoughtworks.xstream.io.xml.XppReader.<init>(
XppReader.java:63)
        at
com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(
AbstractXppDriver.java:54)
        at com.thoughtworks.xstream.XStream.fromXML(XStream.java:913)
        at com.thoughtworks.xstream.XStream.fromXML(XStream.java:904)
        at
org.apache.activemq.transport.xstream.XStreamWireFormat.unmarshalText(
XStreamWireFormat.java:51)
        at
org.apache.activemq.transport.util.TextWireFormat.unmarshal(
TextWireFormat.java:49)
        at
org.apache.activemq.transport.http.HttpClientTransport.run(
HttpClientTransport.java:142)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.EOFException: input contained no data
        at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3003)
        at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1410)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at
com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
        ... 12 more

The code of sending msg is quite straightforwad:

public class SendTest {

        /**
         * @param args
         */
        public static void main(String[] args) {
                String name = ActiveMQConnection.DEFAULT_USER;
                String pwd = ActiveMQConnection.DEFAULT_PASSWORD;
                String url = "http://10.30.101.60:61610";;

                SendUtil sender = new SendUtil(name, pwd, url,
"FirstQueue2");

                for (int i = 0; i < 10; i++) {
                        sender.sendMessage("message" + i);
                }
        }

}

package com.activemq.util;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory;

public class SendUtil {


        private Connection connection = null;

        private Session session;

        private MessageProducer producer;

        public SendUtil(String userName, String pwd, String url, String
queueName)
{

                ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(
                                userName, pwd, url);

                try {

                        connection = connectionFactory.createConnection();
                        connection.start();
                        session = connection.createSession(Boolean.TRUE,
                                        Session.AUTO_ACKNOWLEDGE);
                        Destination destination =
session.createQueue(queueName);
                        producer = session.createProducer(destination);
                        producer.setDeliveryMode(
DeliveryMode.NON_PERSISTENT);

                        sendMessage(session, producer);
                        session.commit();
                } catch (Exception e) {
                        close();
                        e.printStackTrace();
                }
        }

        public void sendMessage(String message) {

                try {

                        TextMessage msg = session.createTextMessage(
message);
                        producer.send(msg);
                        session.commit();
                } catch (JMSException e) {
                        close();
                        e.printStackTrace();
                }
        }

        public void close() {
                try {
                        if (producer != null)
                                producer.close();
                        if (session != null)
                                session.close();
                        if (connection != null)
                                connection.close();

                } catch (Throwable ignore) {
                }
        }
}





--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Reply via email to