From activemq-users-return-30-apmail-geronimo-activemq-users-archive=geronimo.apache.org@geronimo.apache.org Mon Jan 16 22:32:31 2006 Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 91365 invoked from network); 16 Jan 2006 22:32:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Jan 2006 22:32:31 -0000 Received: (qmail 21819 invoked by uid 500); 16 Jan 2006 22:32:31 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 16023 invoked by uid 500); 16 Jan 2006 22:30:48 -0000 Mailing-List: contact activemq-users-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-users@geronimo.apache.org Delivered-To: mailing list activemq-users@geronimo.apache.org Received: (qmail 15945 invoked by uid 99); 16 Jan 2006 22:30:47 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2006 14:30:47 -0800 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [206.190.39.215] (HELO web50313.mail.yahoo.com) (206.190.39.215) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 16 Jan 2006 14:29:50 -0800 Received: (qmail 83958 invoked by uid 60001); 16 Jan 2006 22:29:29 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=rBQelFLttXnS6GMOV4Frl3QP5+/dzyO7ixr06DG84nYBQcj5s3xRQayA6/mRGg8IBKfS0Iq+H3bqgG9k8gwUUsPzGYHLyBQBjFSTgxQjzu/2Fnc9Z+8pCXvDhtGLP/6rjqlQraXIShM+acIm4p+fzyWSECMw9APfkdoB5qzbjkA= ; Message-ID: <20060116222929.83956.qmail@web50313.mail.yahoo.com> Received: from [69.201.142.21] by web50313.mail.yahoo.com via HTTP; Mon, 16 Jan 2006 14:29:29 PST Date: Mon, 16 Jan 2006 14:29:29 -0800 (PST) From: OG Reply-To: ogjunk-amq@yahoo.com Subject: Re: 3.2.1, NPE at DefaultBroker:579 To: activemq-users@geronimo.apache.org In-Reply-To: <20060116200554.50698.qmail@web50308.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, I found James Strachan's pointer to: http://activemq.org/How+can+I+support+auto+reconnection I've been trying to use the "reliable" configuration without any luck so far. I currently have this: .... I am unclear where the "reliable" bit mentioned in docs needs to go. 1) Does it go into serverTransport element's uri attribute? e.g. 2) Or into tcpServerTransport's uri attribute? e.g. 3) Or into networkChannel's uri attribute? e.g. I did have a little bit of luck with this: With this I was able to: - put a message in the JMS queue - stop DB - have ActiveMQ hit the wall (DB down, no connections) - restart DB - have ActiveMQ start acting normally, connecting to DB, etc. Is this a good solution to my problem? Thanks, Otis --- OG wrote: > Hello, > > I'm getting a NPE from DefaultBroker > (./modules/core/src/java/org/activemq/broker/impl/DefaultBroker.java), > line 579 (in release 3.2.1). > > Line 579: > transientTopicMCM.sendMessage(client, message); > > So transientTopicMCM must be null. > > > I get this errors when I try to put something in the JMS queue. > Also, > I should say that I _am_ having some issues with database connections > (running out of them), and this is very likely related to this > problem. > I was wondering if somebody could take a quick look at the code > below, > and tell me if I'm doing something stupid. > > Code and description of DB/connection situation is followed by the > exception stack trace. > > // static block in my code, executed only once in the JVM > // is doing this in a static block a bad idea? > static { > _connectionFactory = new > ActiveMQConnectionFactory(BROKER_URL); > > _connectionFactory.setBrokerXmlConfig(XML_CONFIGURATION_LOCATION); > } > > // called whenever a new message is sent to JMS queue, once for each > message > public Connection createConnection() throws JMSException { > Connection connection = > _connectionFactory.createConnection(); > connection.start(); > return connection; > } > public Session createSession(Connection connection) throws > JMSException { > Session session = connection.createSession(false, ACK_MODE); > return session; > } > public MessageProducer createProducer(Session session, String > queue) throws JMSException { > Destination destination = session.createQueue(queue); > MessageProducer producer = > session.createProducer(destination); > producer.setDeliveryMode(DeliveryMode.PERSISTENT); > return producer; > } > > > The code that sends the message in the first place looks like this: > > > Connection connection = null; > Session session = null; > MessageProducer producer = null; > > try { > // create connection, session, producer > connection = jmsAdapter.createConnection(); > session = jmsAdapter.createSession(connection); > producer = jmsAdapter.createProducer(session, queue); > > // send message > jmsAdapter.sendBinaryMessage(session, producer, > messageContent); > } catch (JMSException e) { > // log and rethrow > } catch (Throwable t) { > // log and rethrow > } > finally { > try { > // release used JMS resources > jmsAdapter.close(connection, session, producer); > } catch (JMSException e1) { > // log and rethrow > } > } > > > It looks to me like there is something in ActiveMQ that gets > nulled/messed-up when the connection to the DB fails (e.g. I run out > of > DB connections). > This makes 100% sense - if the DB is out of connections, and my JMS > queues are stored in the DB, of course ActiveMQ won't be able to get > a > connection. > > However, once my DB recovers and there ARE available connections, > further attempts to get a Connection from ActiveMQConnectionFactory > with the above code go _connectionFactory.getConnection(), STILL > fail. > It looks as if ActiveMQConnectionFactory, once messed up a bit by the > lack of DB connections, never tries to get new connections when its > getConnection() method is called. > > I imagine one way of working around this is to simply create a new > ActiveMQConnectionFactory every time you need a Connection, but this > looks like a misuse of the API. > > Any help would be very appreciated, as I'm having problems with this > on > a production system right now. :( > > > This is the exception stack trace: > > Caused by: javax.jms.JMSException > at > org.activemq.util.JMSExceptionHelper.newJMSException(JMSExceptionHelper.java:49) > at > org.activemq.util.JMSExceptionHelper.newJMSException(JMSExceptionHelper.java:37) > at > org.activemq.util.JMSExceptionHelper.newJMSException(JMSExceptionHelper.java:60) > at > org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1382) > at > org.activemq.ActiveMQConnection.sendConnectionInfoToBroker(ActiveMQConnection.java:1617) > at > org.activemq.ActiveMQConnection.start(ActiveMQConnection.java:643) > at > com.simpy.jms.ActiveMqAdapter.createConnection(ActiveMqAdapter.java:139) > at > com.simpy.jms.JmsQueueService.sendBinaryMessage(JmsQueueService.java:53) > ... 33 more > Caused by: java.lang.NullPointerException > at > org.activemq.broker.impl.DefaultBroker.doMessageSend(DefaultBroker.java:579) > at > org.activemq.broker.impl.DefaultBroker.sendMessage(DefaultBroker.java:320) > at > org.activemq.broker.impl.AdvisorySupport.dispatchToBroker(AdvisorySupport.java:395) > at > org.activemq.broker.impl.AdvisorySupport.addConnection(AdvisorySupport.java:166) > at > org.activemq.broker.impl.DefaultBroker.addClient(DefaultBroker.java:235) > at > org.activemq.broker.impl.BrokerContainerImpl.registerConnection(BrokerContainerImpl.java:316) > at > org.activemq.broker.impl.BrokerConnectorImpl.registerClient(BrokerConnectorImpl.java:154) > at > org.activemq.broker.impl.BrokerClientImpl.consumeConnectionInfo(BrokerClientImpl.java:557) > at > org.activemq.broker.impl.BrokerClientImpl.consume(BrokerClientImpl.java:373) > at > org.activemq.transport.vm.VmTransportChannel.asyncSend(VmTransportChannel.java:143) > at > org.activemq.transport.TransportChannelSupport.doAsyncSend(TransportChannelSupport.java:433) > at > org.activemq.transport.TransportChannelSupport.asyncSendWithReceipt(TransportChannelSupport.java:160) > at > org.activemq.transport.TransportChannelSupport.send(TransportChannelSupport.java:145) > at > org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1377) > ... 37 more > > > Thanks, > Otis > >