activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: activeMQ embedded broker in separate war
Date Wed, 02 Aug 2006 06:45:20 GMT
On 8/2/06, Hyatt <> wrote:
> I am an ActiveMQ newbie.  I am having some of the same issues expressed in
> this thread.  I'd like to use embedded broker(s); but, I want to separate
> the management web-app (console example) from the end-user web-app (chat
> example).
> + Config and run the ActiveMQ web-console example: Okay, Done, works great
> + Config and run the ActiveMQ chat example: Okay, Done, works great
> + Run the web-console AND the chat example, as two separate web-apps: Crash,
> Burn, Smoke, Fire (I can reproduce and send errors if needed, but the errors
> are more inline with other email threads about Journal file already in-use
> and cannot create broker because broker is already running....I read those
> threads, and decided that the solutions provided here are closer to what I
> think I need).

So WARs are their own separate class loaders. So running an embedded
broker in each war will cause problems as you are really running 2

So either...

(i) put the ActiveMQ classes in your system classpath so there is only
1 broker shared in each WAR's class loader

(ii) remove the embedded broker from one of the wars and connect to
the embedded broker via tcp

We could also change the web console so that it doesn't use an
embedded broker but so that it connects to the other broker via JMX.

> Let's start with the chat example, and start with James Strachan's comment:
> > The VM transport only works when the JMS client and broker are in the
> > same classloader. If you are using 2 separate WARs then the VM
> > transport cannot be used - so you'll have to use TCP to connect to the
> > same broker
> Excellent, I've read that embedded brokers can be created with EITHER:
> vm://localhost OR tcp://localhost:port.  CORRECT?
> I changed the web.xml file.  I changed what worked (vm://localhost) to (I
> tried all of these):
> tcp://localhost FAILED
> tcp://localhost:61616 FAILED
> tcp://localhost:8084 (the port used by NetBean's Bundled Tomcat server at
> runtime) FAILED
> If I can get the chat example to work with an embedded broker using tcp://
> rather than vm://, then I should be able to use the rest of the information
> in this thread to access the embedded broker from two web-apps.
> Am I doing enough by changing the web.xml, or do I need to change the broker
> connections in the Java code?  What am I doing wrong?
> Using Linux, Tomcat, ActiveMQ 4.0.1, Java 1.5
> Thanks for your help.

So configure an embedded broker in one of the WARs with a speciifc TCP
port (e.g. using the default activemq.xml that comes with the web
console) - then connect to it with tcp://localhost:61616



View raw message