[ https://issues.apache.org/activemq/browse/AMQ-321?page=comments#action_36308 ]
Hiram Chirino commented on AMQ-321: ----------------------------------- Do we know if this is still the case in 4.0? > 'reliable' does not work for http > --------------------------------- > > Key: AMQ-321 > URL: https://issues.apache.org/activemq/browse/AMQ-321 > Project: ActiveMQ > Type: New Feature > Components: Transport > Versions: 3.1 > Environment: Windows 2000 > jdk 1.4.2_06 > Reporter: Hans Dockter > Priority: Critical > Attachments: reliable_bug_test_case.zip > > > There are so many wonderful features in your product. It is such a pity that > many of them don't work properly with http. Here are two problems I have (in > one or the other way since a very long time, that spans many releases). The > code to reproduce the bugs is appended at the end as well as attached. > Reliable does not work correctly with http. > 1.) > If I start the producer before the broker, the producer starts a loop trying > to connect. If I start the broker the following happens: > tcp: The producer sends the message. > http: An exception is thrown by the broker (see the log at the end of this > mail: Exception 1). > 2.) > If I start the broker, then the consumer the following happens: > tcp: Nothing special > http without reliable: Nothing special > http with reliable: Exception as in the case above is thrown by the broker. > Here is the code to reproduce the stated behaviour. > -------------- Broker > import javax.jms.JMSException; > import org.activemq.broker.BrokerContainer; > import org.activemq.broker.impl.BrokerContainerImpl; > import org.activemq.store.vm.VMPersistenceAdapter; > public class Broker { > public static final String BROKER_URL = "tcp://localhost:8081"; > public static void main(String[] args) throws JMSException, > InterruptedException { > BrokerContainer container = new BrokerContainerImpl("remoteBroker"); > container.addConnector(BROKER_URL); > container.setPersistenceAdapter(new VMPersistenceAdapter()); > container.start(); > // lets wait until we're killed. > Object lock = new Object(); > synchronized (lock) { > lock.wait(); > } > } > } > ---------------- Producer > import javax.jms.Connection; > import javax.jms.Destination; > import javax.jms.JMSException; > import javax.jms.MessageProducer; > import javax.jms.Session; > import javax.jms.TextMessage; > import org.activemq.ActiveMQConnectionFactory; > public class Producer { > public static void main(String[] args) throws JMSException { > ActiveMQConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("reliable:" + Broker.BROKER_URL); > Connection connection = connectionFactory.createConnection(); > Session session = connection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > TextMessage textMessage = session.createTextMessage(); > textMessage.setText("hans"); > Destination destination = session.createQueue("queue"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.send(destination, textMessage); > System.out.println("send: " + textMessage); > System.exit(0); > } > } > ----------------- Consumer > import javax.jms.Connection; > import javax.jms.Destination; > import javax.jms.JMSException; > import javax.jms.Message; > import javax.jms.MessageConsumer; > import javax.jms.MessageListener; > import javax.jms.Session; > import org.activemq.ActiveMQConnectionFactory; > public class Consumer { > public static void main(String[] args) throws JMSException { > System.setProperty("activemq.persistenceAdapterFactory", > "org.activemq.store.vm.VMPersistenceAdapterFactory"); > ActiveMQConnectionFactory connectionFactory = new > ActiveMQConnectionFactory( > "reliable:" + Broker.BROKER_URL); > Connection connection = connectionFactory.createConnection(); > Session session = connection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > Destination destination = session.createQueue("queue"); > MessageConsumer messageConsumer = session.createConsumer(destination); > messageConsumer.setMessageListener(new MessageListener() { > public void onMessage(Message message) { > System.out.println("Received: " + message); > } > }); > connection.start(); > } > } > ------------Exception 1 > 969 [SocketListener0-0] WARN org.activemq.transport.http.HttpTunnelServlet > - No clientID header so ignoring request > 969 [SocketListener0-0] WARN / - /: > java.lang.NullPointerException > at > org.activemq.transport.http.HttpTunnelServlet.doPost(HttpTunnelServlet.java:114) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:615) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > at > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427) > at > org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:665) > at > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567) > at org.mortbay.http.HttpContext.handle(HttpContext.java:1565) > at org.mortbay.http.HttpContext.handle(HttpContext.java:1517) > at org.mortbay.http.HttpServer.service(HttpServer.java:954) > at org.mortbay.http.HttpConnection.service(HttpConnection.java:814) > at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981) > at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831) > at > org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244) > at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357) > at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
