activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Mielke <>
Subject Re: Duplicate brokers created in Tomcat
Date Wed, 15 Feb 2012 09:58:28 GMT

Looks like you get two embedded broker instances created at runtime in the same JVM. As both
instances use probably the same configuration, they both compete over the same lock on the
same kahadb folder on the file system. 
Both of your project use the same broker url vm://. As you know, the vm transport is for connecting
to an embedded broker. Both projects are in their own war file with their own spring context
and configuration. So at runtime each project does not know anything about a broker already
being present in the other project.

Do you really want to use an embedded broker or is an external broker better suited? The easiest
solution is to use an external broker and change the broker url to be tcp://localhost:61616,
or whatever address the broker runs on. 
That way the brokers lifetime isn't bound to the lifetime of Tomcat or your deployed web applications.

Hope this helps.

Torsten Mielke

On Feb 15, 2012, at 1:01 AM, msmith wrote:

> Hello. I have a similar problem that I would greatly appreciate any guidance
> towards resolving it. 
> I divided up a Spring web application into two WAR files and deployed them
> onto an Apache Tomcat 7 server. If either WAR is deployed I get no errors
> and can view the associated web pages, but if both are deployed at the same
> time the log states:         
> INFO : -
> PListStore:..\activemq-data\localhost\tmp_storage started
> INFO : - Using Persistence Adapter:
> KahaDBPersistenceAdapter[C:\Program Files\Apache Software Foundation\Tomcat
> 7.0\..\activemq-data\localhost\KahaDB]
> INFO : - Database
> ..\activemq-data\localhost\KahaDB\lock is locked... waiting 10 seconds for
> the database to be unlocked. Reason: File
> '..\activemq-data\localhost\KahaDB\lock' could not be locked as lock is
> already held for this jvm.
> INFO : - Database
> ..\activemq-data\localhost\KahaDB\lock is locked... waiting 10 seconds for
> the database to be unlocked. Reason: File
> '..\activemq-data\localhost\KahaDB\lock' could not be locked as lock is
> already held for this jvm.
> The Tomcat server uses activemq-data and KahaDB as its file based
> persistence database (not sure what version - my apologies). Both projects
> contain the same (duplicate) ConnectionFactory bean:     
> <bean id=&quot;connectionFactory&quot;
> class=&quot;&lt;b>org.springframework.jms.connection.CachingConnectionFactory*"
>        p:exceptionListener-ref="jmsExceptionListener"
> p:sessionCacheSize="100">
>        <constructor-arg ref="amqConnectionFactory" />
> </bean>
> Finally, the jms broker URL specified within each project is:
> url=vm://localhost?broker.useJmx=false&broker.dataDirectory=../activemq-data
> I have been reading up on embedded vs. standalone activemq servers and have
> tried implementing both but have not met with success. My problem(s) here
> may be an obvious one  - I have been looking too long at this and would
> welcome any suggestions or thoughts.
> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at

View raw message