You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Dysan <sb...@hotmail.fr> on 2011/12/01 16:25:55 UTC
Multiple war in Tomcat 7 using a shared embedded ActiveMQ
Hi,
I'm working on a project where several war inside a tomcat 7 have to
communicate with a single embedded activeMQ (5.5.1) broker inside the same
Tomcat.
I'm wondering what was the best practice to manage this and how to start and
stop the broker properly.
Actually i try tu use a global JNDI entry in server.xml and in each war get
my activemq connection with a lookup. The first connection to the broker
implicitly starts it. But with this method I run into various problems like
instance already existing or locks in data store.
Should I use instead an additional war which uses a BrokerFactory to start
the broker explicitly ? In this case how to make sure that this war executes
first in Tomcat ? And how do I stop my broker and where ?
Thanks for the help.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Multiple-war-in-Tomcat-7-using-a-shared-embedded-ActiveMQ-tp4128926p4128926.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
Posted by Dysan <sb...@hotmail.fr>.
Thank for your response.
I see my questions are not obvious :)
And indeed after some few days spent to solve these problems i think i will
have to use a standalone broker .
--
View this message in context: http://activemq.2283324.n4.nabble.com/Multiple-war-in-Tomcat-7-using-a-shared-embedded-ActiveMQ-tp4128926p4147011.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Reply:Re: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
Posted by SuoNayi <su...@163.com>.
You can refer to the following url as well.
In one word it says that there is no mechanism or guarantee to control the load order of WAR for TOMCAT.
http://efreedom.com/Question/1-6698646/Way-Enforce-Deployment-Order-Tomcat6
At 2011-12-02 17:24:10,"Torsten Mielke" <to...@fusesource.com> wrote:
>Hi,
>
>At first I thought you could simply use the vm transport as the first client to use it would boot an embedded broker. But then the brokers life time depends on that war. Also, I presume this could result in class loading issues at runtime?
>
>The better approach seems to be deploying the broker as its own war. This introduces the problem of ensuring the broker gets started first but I would hope that Tomcat has a solution to offer. You can still stop the broker by stopping or undeploying the entire war file.
>
>Does it really need to be an embedded broker or could the broker also run standalone mode? You can then manage its life cycle completely independent of Tomcat.
>
>Regards,
>
>Torsten Mielke
>torsten@fusesource.com
>tmielke@blogspot.com
>
>
>On Dec 1, 2011, at 4:25 PM, Dysan wrote:
>
>> Hi,
>>
>> I'm working on a project where several war inside a tomcat 7 have to
>> communicate with a single embedded activeMQ (5.5.1) broker inside the same
>> Tomcat.
>>
>> I'm wondering what was the best practice to manage this and how to start and
>> stop the broker properly.
>>
>> Actually i try tu use a global JNDI entry in server.xml and in each war get
>> my activemq connection with a lookup. The first connection to the broker
>> implicitly starts it. But with this method I run into various problems like
>> instance already existing or locks in data store.
>>
>> Should I use instead an additional war which uses a BrokerFactory to start
>> the broker explicitly ? In this case how to make sure that this war executes
>> first in Tomcat ? And how do I stop my broker and where ?
>>
>> Thanks for the help.
>>
>
>
>
>
Re: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
Posted by Torsten Mielke <to...@fusesource.com>.
Hi,
At first I thought you could simply use the vm transport as the first client to use it would boot an embedded broker. But then the brokers life time depends on that war. Also, I presume this could result in class loading issues at runtime?
The better approach seems to be deploying the broker as its own war. This introduces the problem of ensuring the broker gets started first but I would hope that Tomcat has a solution to offer. You can still stop the broker by stopping or undeploying the entire war file.
Does it really need to be an embedded broker or could the broker also run standalone mode? You can then manage its life cycle completely independent of Tomcat.
Regards,
Torsten Mielke
torsten@fusesource.com
tmielke@blogspot.com
On Dec 1, 2011, at 4:25 PM, Dysan wrote:
> Hi,
>
> I'm working on a project where several war inside a tomcat 7 have to
> communicate with a single embedded activeMQ (5.5.1) broker inside the same
> Tomcat.
>
> I'm wondering what was the best practice to manage this and how to start and
> stop the broker properly.
>
> Actually i try tu use a global JNDI entry in server.xml and in each war get
> my activemq connection with a lookup. The first connection to the broker
> implicitly starts it. But with this method I run into various problems like
> instance already existing or locks in data store.
>
> Should I use instead an additional war which uses a BrokerFactory to start
> the broker explicitly ? In this case how to make sure that this war executes
> first in Tomcat ? And how do I stop my broker and where ?
>
> Thanks for the help.
>
Re: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
Posted by Claudio Corsi <cl...@yahoo.com>.
Sorry but I have never even looked at that.
If it uses tomcat under that cover then you could probably use the same technique that I have mentioned here but again I do not know if that will work.
If you have any experience with this app server you should see if there is a server.xml file that includes the listerner element.
--Claudio
>________________________________
> From: Daoud Abdelmonem Faleh <ab...@gmail.com>
>To: users@activemq.apache.org; Claudio Corsi <cl...@yahoo.com>
>Sent: Monday, December 5, 2011 9:50 AM
>Subject: Re: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
>
>What about Apache TomEE? http://openejb.apache.org/apache-tomee.html
>
>On Mon, Dec 5, 2011 at 3:46 AM, Claudio Corsi <cl...@yahoo.com> wrote:
>> Hi Dysan,
>>
>> I am not a tomcat expert but just looking at the server.xml file. There is the concept of a listener that you might want to consider as a way to start/stop the activemq broker.
>>
>> Here is a pointer to the javadoc.
>>
>> http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/LifecycleListener.html
>>
>> It receives a lifecycleevent instance that you can use to determine in which cycle the tomcat server is currently processing.
>>
>>
>> Looking at the javadoc you should be able to determine which lifecycle event you should start the broker on and which cycle event you should shutdown the server.
>>
>> You could then define a mechanism to determine which connection information you should use to connect to the broker.
>>
>> This is just part of the general v7 javadoc located at:
>>
>> http://tomcat.apache.org/tomcat-7.0-doc/api/index.html
>>
>>
>> Hope this helps,
>>
>> --Claudio
>>
>>
>>
>>>________________________________
>>> From: Dysan <sb...@hotmail.fr>
>>>To: users@activemq.apache.org
>>>Sent: Thursday, December 1, 2011 10:25 AM
>>>Subject: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
>>>
>>>Hi,
>>>
>>>I'm working on a project where several war inside a tomcat 7 have to
>>>communicate with a single embedded activeMQ (5.5.1) broker inside the same
>>>Tomcat.
>>>
>>>I'm wondering what was the best practice to manage this and how to start and
>>>stop the broker properly.
>>>
>>>Actually i try tu use a global JNDI entry in server.xml and in each war get
>>>my activemq connection with a lookup. The first connection to the broker
>>>implicitly starts it. But with this method I run into various problems like
>>>instance already existing or locks in data store.
>>>
>>>Should I use instead an additional war which uses a BrokerFactory to start
>>>the broker explicitly ? In this case how to make sure that this war executes
>>>first in Tomcat ? And how do I stop my broker and where ?
>>>
>>>Thanks for the help.
>>>
>>>
>>>--
>>>View this message in context: http://activemq.2283324.n4.nabble.com/Multiple-war-in-Tomcat-7-using-a-shared-embedded-ActiveMQ-tp4128926p4128926.html
>>>Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>>
>>>
>
>
>
Re: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
Posted by Daoud Abdelmonem Faleh <ab...@gmail.com>.
What about Apache TomEE? http://openejb.apache.org/apache-tomee.html
On Mon, Dec 5, 2011 at 3:46 AM, Claudio Corsi <cl...@yahoo.com> wrote:
> Hi Dysan,
>
> I am not a tomcat expert but just looking at the server.xml file. There is the concept of a listener that you might want to consider as a way to start/stop the activemq broker.
>
> Here is a pointer to the javadoc.
>
> http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/LifecycleListener.html
>
> It receives a lifecycleevent instance that you can use to determine in which cycle the tomcat server is currently processing.
>
>
> Looking at the javadoc you should be able to determine which lifecycle event you should start the broker on and which cycle event you should shutdown the server.
>
> You could then define a mechanism to determine which connection information you should use to connect to the broker.
>
> This is just part of the general v7 javadoc located at:
>
> http://tomcat.apache.org/tomcat-7.0-doc/api/index.html
>
>
> Hope this helps,
>
> --Claudio
>
>
>
>>________________________________
>> From: Dysan <sb...@hotmail.fr>
>>To: users@activemq.apache.org
>>Sent: Thursday, December 1, 2011 10:25 AM
>>Subject: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
>>
>>Hi,
>>
>>I'm working on a project where several war inside a tomcat 7 have to
>>communicate with a single embedded activeMQ (5.5.1) broker inside the same
>>Tomcat.
>>
>>I'm wondering what was the best practice to manage this and how to start and
>>stop the broker properly.
>>
>>Actually i try tu use a global JNDI entry in server.xml and in each war get
>>my activemq connection with a lookup. The first connection to the broker
>>implicitly starts it. But with this method I run into various problems like
>>instance already existing or locks in data store.
>>
>>Should I use instead an additional war which uses a BrokerFactory to start
>>the broker explicitly ? In this case how to make sure that this war executes
>>first in Tomcat ? And how do I stop my broker and where ?
>>
>>Thanks for the help.
>>
>>
>>--
>>View this message in context: http://activemq.2283324.n4.nabble.com/Multiple-war-in-Tomcat-7-using-a-shared-embedded-ActiveMQ-tp4128926p4128926.html
>>Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
>>
Re: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
Posted by Claudio Corsi <cl...@yahoo.com>.
Hi Dysan,
I am not a tomcat expert but just looking at the server.xml file. There is the concept of a listener that you might want to consider as a way to start/stop the activemq broker.
Here is a pointer to the javadoc.
http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/LifecycleListener.html
It receives a lifecycleevent instance that you can use to determine in which cycle the tomcat server is currently processing.
Looking at the javadoc you should be able to determine which lifecycle event you should start the broker on and which cycle event you should shutdown the server.
You could then define a mechanism to determine which connection information you should use to connect to the broker.
This is just part of the general v7 javadoc located at:
http://tomcat.apache.org/tomcat-7.0-doc/api/index.html
Hope this helps,
--Claudio
>________________________________
> From: Dysan <sb...@hotmail.fr>
>To: users@activemq.apache.org
>Sent: Thursday, December 1, 2011 10:25 AM
>Subject: Multiple war in Tomcat 7 using a shared embedded ActiveMQ
>
>Hi,
>
>I'm working on a project where several war inside a tomcat 7 have to
>communicate with a single embedded activeMQ (5.5.1) broker inside the same
>Tomcat.
>
>I'm wondering what was the best practice to manage this and how to start and
>stop the broker properly.
>
>Actually i try tu use a global JNDI entry in server.xml and in each war get
>my activemq connection with a lookup. The first connection to the broker
>implicitly starts it. But with this method I run into various problems like
>instance already existing or locks in data store.
>
>Should I use instead an additional war which uses a BrokerFactory to start
>the broker explicitly ? In this case how to make sure that this war executes
>first in Tomcat ? And how do I stop my broker and where ?
>
>Thanks for the help.
>
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/Multiple-war-in-Tomcat-7-using-a-shared-embedded-ActiveMQ-tp4128926p4128926.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>
>