tags:

views:

20

answers:

1

Hi All,

I'm trying to send a message using JMS from a servlet (running on Apache Tomcat) to ActiveMQ running in a different VM on the same system.

Things i have tried:

  1. Running ActiveMQ on my system.
  2. Wrote a client (Java app) (Producer) to create messages.
  3. Wrote a client (Java app) (Consumer) to receive those messages.

The above setup works fine.

Now, i have a servlet, which looks up the resources via JNDI. This is the configuration of context.xml in META-INF directory of Tomcat.

<Context>
    <Resource 
            name="jms/ConnectionFactory" 
            auth="Container" 
            type="org.apache.activemq.ActiveMQConnectionFactory" 
            description="JMS Connection Factory"
            factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
            brokerURL=" tcp://localhost:61616" 
    />
</Context>

I'm able to lookup these resources from the sevlet. The message is sent. But i think it is not reaching the ActiveMQ. Any ideas why ?

I feel it is sending it to some other destination vm://localhost running within the container? which is not what i want. I'm new to MOM.

If someone could tell me how to send a JMS message from a servlet to a remote Broker, it would be great.

A: 

If you are looking up the connection via JNDI that is pointed at an ActiveMQ instance at tcp://localhost:61616, that is not a remote broker. That is a broker running on the local machine on port 61616. If you want the connection to made to a remote broker on another machine, then replace localhost with the IP address.

Bruce

bsnyder
Hi Bruce, thanks for your time. ActiveMQ is running on the same system but as a different process. How do i connect to it any ideas ? It is running in a different VM .
Voicestreams
If it's running on the same system but on a different port, then you just need to point to the correct port number.
bsnyder