You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by OG <og...@yahoo.com> on 2006/01/17 21:56:00 UTC
3.2.1, NPE at DefaultBroker:579 after DB conn loss
Hello,
I'm not having much luck on activemq-user@, so I'm trying -dev. Are
people still on the old Codehaus mailing lists?
My first email is below, and a few follow-ups with exception traces and
ERROR messages from logs are here:
http://mail-archives.apache.org/mod_mbox/geronimo-activemq-users/200601.mbox/thread
Any help would be reeeeeally appreciated, as I'm having this problem on
a production service - http://www.simpy.com/ . Thanks.
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