activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nate M (JIRA)" <>
Subject [jira] [Commented] (AMQ-5161) NullPointerException during async startup
Date Fri, 16 May 2014 11:23:05 GMT


Nate M commented on AMQ-5161:

If I'm reading it correctly (for which there is a high probability that I'm not), the current
check to see if the broker has started in the VMTransportFactory's lookupBroker method are
bypassed during async startup, because as Timothy mentioned, the broker is registered just
as the broker startup, and before initialization of key references, begins. Consequently,
the incoming VM transport will not wait for the specified period of time nor wait until the
broker is started to proceed with initiating the connection. 

            broker = registry.lookup(brokerName);
            if (broker == null && waitForStart > 0) {
                final long expiry = System.currentTimeMillis() + waitForStart;
                while ((broker == null || !broker.isStarted()) && expiry > System.currentTimeMillis())
It appears that perhaps 1) the broker registration in the registry should somehow be postponed
until the end of the async startup, 2) the required broker references should be initialized
before the async startup begins a version of which is done in James' workaround, or 3) the
broker.isStarted() check can always be required in the lookupBroker method, not just when
the broker can't yet be found in the registry.

Incidentally, I saw a comment on an old ticket saying, "Brokers agains start synchronously
by default, which is needed for vm transport embedded case"  (

> NullPointerException during async startup
> -----------------------------------------
>                 Key: AMQ-5161
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.9.1
>            Reporter: james
>         Attachments:
> I'm using an embedded broker with asynchronous startup enabled.  My setup worked using
5.9.0.  When i upgraded to 5.9.1, i started getting this exception on startup:
> {noformat}
> javax.jms.JMSException: java.lang.NullPointerException
>   at org.apache.activemq.util.JMSExceptionSupport.create(
>   at org.apache.activemq.ActiveMQConnection.syncSendPacket(
>   at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(
>   at org.apache.activemq.ActiveMQConnection.setClientID(
>   at <...internal system startup stack trace...>
> Caused by: java.lang.NullPointerException
>   at
>   at
>   at org.apache.activemq.advisory.AdvisoryBroker.addConnection(
>   at
>   at
>   at
>   at
>   at
>   at org.apache.activemq.command.ConnectionInfo.visit(
>   at
>   at$1.onCommand(
>   at org.apache.activemq.transport.ResponseCorrelator.onCommand(
>   at org.apache.activemq.transport.MutexTransport.onCommand(
>   at org.apache.activemq.transport.vm.VMTransport.iterate(
>   at org.apache.activemq.thread.PooledTaskRunner.runTask(
>   at org.apache.activemq.thread.PooledTaskRunner$
>   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
>   at java.util.concurrent.ThreadPoolExecutor$
>   at
> {noformat}

This message was sent by Atlassian JIRA

View raw message