On 7/9/07, Suchitha Koneru (sukoneru) <[EMAIL PROTECTED]> wrote:
The approach which I used for starting active mq broker via Tomcat
server is  as follows

1) Include the connection factory for starting the active mq broker in
Tomcat/conf/context.xml as follows

      <Resource
                name="jms/ConnectionFactory"
                auth="Container"
                type="org.apache.activemq.ActiveMQConnectionFactory"
                description="JMS Connection Factory"
                factory="org.apache.activemq.jndi.JNDIReferenceFactory"

brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml"

       />
Make sure that activemq.xml should be present in the classpath of
Tomcat.  You can also specify brokerConfig as
brokerConfig=xbean:file:./activemq.xml.


3)The active mq jars should be placed under (Tomcat/common/lib) of
Tomcat


4)The Queues/Topics can be defined under  Tomcat/conf/context.xml.
      <Resource name="jms/TopicOne"
                  auth="Container"
                  type="org.apache.activemq.command.ActiveMQTopic"
                  description="the topic against which the client back
end will publish and server back end would subscribe"

factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                  physicalName="FOO1.BAR"/>


      <Resource name="jms/TopicTwo"
                  auth="Container"
                  type="org.apache.activemq.command.ActiveMQTopic"
                  description="the topic against which the server back
end will publish and client back end would subscribe"

factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                  physicalName="FOO2.BAR"/>




5) The code for connecting to the broker is as follows

        Ictx = new javax.naming.InitialContext();
        envContext = (Context) Ictx.lookup("java:comp/env");
                TopicConnectionFactory  sampleconnectionFactory =

(TopicConnectionFactoryenvContext.lookup("jms/ConnectionFactory");




The broker is created and started when the first attempt to connect to
the broker is made.

Thanks,
Suchitha.

-----Original Message-----
From: Sandeep Chayapathi [mailto:[EMAIL PROTECTED]
Sent: Monday, July 09, 2007 8:51 AM
To: users@activemq.apache.org
Subject: Re: Trying to get started: how do I configure Tomcat to run
ActiveMQ?


Hi,
 Im not sure if activemq can be started via tomcat, however I know you
can publish/subscribe to activemq topics/queue over web interface. You
need to copy/link few of the jar files in activemq/lib and
activemq/lib/optional to tomcat's lib folder.

 Then in tomcat's conf/web.xml:

1. add context params params for: org.apache.activemq.brokerURL and turn
on
    org.apache.activemq.embeddedBroker

2. map REST servlets, mainly the : org.apache.activemq.web.AjaxServlet
and
    org.apache.activemq.web.MessageServlet

3. map url to the above servlets, by practise, you can use /amq and
/message

for further help, checkout the
https://svn.apache.org/repos/asf/activemq/trunk/activemq-web-demo/
activemq-web-demo

- Sandeep


Henk van Voorthuijsen wrote:
>
> After downloading ActiveMQ 4.1.1, I managed to sucessfully run it as
> stand-alone.
> As a following step, I tried to get Tomcat to start the same process -

> and that's where I get lost!
>
> I have tried adding a ConnectionFactory and Queue to the
> <GlobalNamingResources> element, and they do show up on the resource
> page of the Tomcat manager, but so far I can see no processes being
started.
>
> A step-by-step description of how to do this would be much
appreciated.
>
> Henk van Voorthuijsen
>
> PS. My configuration:
> Windows XP
> Tomcat 5.5.17
> ActiveMQ 4.1.1

This is great info for others in the community. It would really be
great if you could add more detail to the Tomcat page on the ActiveMQ
website:

http://activemq.apache.org/setting-up-activemq-with-tomcat-559.html

Just register for a wiki account here:

http://cwiki.apache.org/confluence/signup.action

And as soon as that is complete, you can start adding or editing pages
on the wiki.

Bruce
--
perl -e 'print unpack("u30","D0G)[EMAIL 
PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/

Reply via email to