Your not running this from within a thread by any chance? I don't
believe connection.start() is going to block, so try and create the
connection outside the thread and pass it in by reference to the thread
instance.

HTH
/Dave


On Thu, Jun 12, 2008 at 10:30 PM, eaglepointe <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I'm new to ActiveMQ and having problem with durable subscription, following
> code based on example code,
>
> ===================================================================
>   public void run() throws JMSException {
>        ActiveMQConnectionFactory factory = new
> ActiveMQConnectionFactory(url);
>        connection = factory.createConnection();
>        connection.setClientID("myClient");
>        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
>        topic = session.createTopic("topictest.messages");
>        control = session.createTopic("topictest.control");
>
>        TopicSubscriber consumer =
> session.createDurableSubscriber(topic,"myDurable1");
>        //MessageConsumer consumer = session.createConsumer(topic);
>        consumer.setMessageListener(this);
>
>        producer = session.createProducer(control);
>
>        System.out.println("Waiting for messages...");
>        connection.start();
>    }
> =================================================================
>
> is causing exceptions on broker side and client side, below are the
> exceptions
>
> broker side:
>
> ERROR Service                        - Async error occurred:
> java.lang.NullPointerException
> java.lang.NullPointerException
>        at
>
> org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:479)
>        at
> org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:105)
>        at
>
> org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:292)
>        at
>
> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:180)
>        at
>
> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
>        at
>
> org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:143)
>        at
>
> org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:206)
>        at
>
> org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
>        at
> org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:196)
>        at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:183)
>        at java.lang.Thread.run(Thread.java:619)
>
> client side:
>
> Exception in thread "ActiveMQ Session Task"
> java.util.concurrent.RejectedExecutionException
>        at
>
> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(Unknown
> Source)
>        at java.util.concurrent.ThreadPoolExecutor.reject(Unknown Source)
>        at java.util.concurrent.ThreadPoolExecutor.execute(Unknown Source)
>        at
>
> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:144)
>        at
> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
> Source)
>        at java.lang.Thread.run(Unknown Source)
>
>
> Any idea? Thanks in advance!
>
> --
> View this message in context:
> http://www.nabble.com/having-problem-with-durable-subscription-tp17813954p17813954.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Reply via email to