Thanks Bruce. You got me in the right direction. My connectionFactory had already locked the data directory causing my custom startup code to hang. I used "create=false" in my brokerURL on the connectionFactory and now it is starting up correctly.
bsnyder wrote: > > On Thu, Apr 2, 2009 at 10:48 AM, virtualshock <nab...@virtualshock.net> > wrote: >> >> I am running ActiveMQ embedded in another application and it seems like >> it is >> running correctly but broker.start() never returns which is hanging the >> startup of my program. In 4.x I didn't have this problem. >> Here is a code snippet of how I am starting ActiveMQ : >> >> broker = new BrokerService(); >> broker.setBrokerName(getInternalConnectionName()); >> broker.getManagementContext().setCreateConnector(false); >> broker.setPersistent(true); >> broker.addConnector(getExternalConnectionURL()); >> broker.start(); >> >> Here is the log output : >> >> 2009-04-02 11:14:42,884 [WrapperListener_start_runner] DEBUG >> com.xxxx.agents.ActiveMQAgent - Starting >> ActiveMQAgent:tcp://localhost:61616 >> & vm://embeddedActiveMQBroker >> 2009-04-02 11:14:42,885 [WrapperListener_start_runner] INFO >> org.apache.activemq.broker.BrokerService - Using Persistence Adapter: >> AMQPersistenceAdapter(activemq-data/embeddedActiveMQBroker) >> 2009-04-02 11:14:42,885 [WrapperListener_start_runner] WARN >> org.apache.activemq.store.amq.AMQPersistenceAdapter - Waiting to Lock the >> Store activemq-data/embeddedActiveMQBroker > > Looks like the problem is above. There must be a lock on the data > directory that hasn't been removed. Do you have more than one broker > pointed at the same data directory? If so, this is correct > functionality and is known as shared filesystem master/slave: > > http://activemq.apache.org/shared-file-system-master-slave.html > > If you don't have another broker pointed at the same data directory, > then it sounds like there might be a stale lock on the data directory. > You can manually locate the lock file and remove it or you can delete > the data directory completely and ActiveMQ will create a new data > directory upon restart. > > Make sure that you're shutting down the broker using the > BrokerService.stop() method? > > Bruce > -- > perl -e 'print > unpack("u30","D0G)u8...@4vyy9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" > );' > > Apache ActiveMQ - http://activemq.apache.org/ > Apache Camel - http://camel.apache.org/ > Apache ServiceMix - http://servicemix.apache.org/ > > Blog: http://bruceblog.org/ > > -- View this message in context: http://www.nabble.com/ActiveMQ-5.2.0---Problem-starting-a-BrokerService-programmatically.-tp22851125p22854695.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.