archana saini | 23 Jan 15:10 2011
Picon

Not able to start connection with ActiveMQ broker from a network client.


Hi All,

I am new to ActiveMQ. I have to write a consumer for activeMQ queue.
ActiveMQ brokers already setup by other team. 

When i am trying to connect to broker using tcp it stuck at line
connection.start().
Java control doesnt go beyond this line. I never recieved an
exception/error.. it seems its waiting for connection. 

Belwo is teh simple code i am using. As i havent setup ActiveMQ, i am just
trying to recieve messge from a queue. I do not have setup info of activeMQ,
is there some setting required at ActiveMQ setup end. 

Note:- ActiveMq setup are on different server i am runnning cosumer on my
local. So it is connection over teh network.

Code:-

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.Session;

import org.apache.activemq.ActiveMQConnectionFactory;
public class ActiveMQTest {
	
(Continue reading)

Timothy Bish | 23 Jan 16:30 2011
Picon

Re: Not able to start connection with ActiveMQ broker from a network client.

On Sun, 2011-01-23 at 06:10 -0800, archana saini wrote:
> Hi All,
> 
> I am new to ActiveMQ. I have to write a consumer for activeMQ queue.
> ActiveMQ brokers already setup by other team. 
> 
> When i am trying to connect to broker using tcp it stuck at line
> connection.start().
> Java control doesnt go beyond this line. I never recieved an
> exception/error.. it seems its waiting for connection. 
> 
> Belwo is teh simple code i am using. As i havent setup ActiveMQ, i am just
> trying to recieve messge from a queue. I do not have setup info of activeMQ,
> is there some setting required at ActiveMQ setup end. 
> 
> Note:- ActiveMq setup are on different server i am runnning cosumer on my
> local. So it is connection over teh network.
> 
> Code:-
> 
> import javax.jms.Connection;
> import javax.jms.ConnectionFactory;
> import javax.jms.Destination;
> import javax.jms.JMSException;
> import javax.jms.MessageConsumer;
> import javax.jms.Session;
> 
> import org.apache.activemq.ActiveMQConnectionFactory;
> public class ActiveMQTest {
> 	
(Continue reading)

archana saini | 23 Jan 16:38 2011
Picon

Re: Not able to start connection with ActiveMQ broker from a network client.


Thanks for your quick reply Tim.

If i remove the failover, i get the connection refused error:-

------
Exception in thread "main" javax.jms.JMSException: Could not connect to
broker URL: tcp://rpc1044.daytonoh.ncr.com:61616?trace=true. Reason:
java.net.ConnectException: Connection refused: connect
	at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
	at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:286)
	at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:230)
	at
org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:178)
	at ActiveMQTest.<init>(ActiveMQTest.java:22)
	at ActiveMQTest.main(ActiveMQTest.java:37)
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at
org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:484)
	at
org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:447)
(Continue reading)

Timothy Bish | 23 Jan 16:43 2011
Picon

Re: Not able to start connection with ActiveMQ broker from a network client.

On Sun, 2011-01-23 at 07:38 -0800, archana saini wrote:
> Thanks for your quick reply Tim.
> 
> If i remove the failover, i get the connection refused error:-
> 
> 
> ------
> Exception in thread "main" javax.jms.JMSException: Could not connect to
> broker URL: tcp://rpc1044.daytonoh.ncr.com:61616?trace=true. Reason:
> java.net.ConnectException: Connection refused: connect
> 	at
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
> 	at
> org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:286)
> 	at
> org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:230)
> 	at
> org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:178)
> 	at ActiveMQTest.<init>(ActiveMQTest.java:22)
> 	at ActiveMQTest.main(ActiveMQTest.java:37)
> Caused by: java.net.ConnectException: Connection refused: connect
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(Unknown Source)
> 	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> 	at java.net.PlainSocketImpl.connect(Unknown Source)
> 	at java.net.SocksSocketImpl.connect(Unknown Source)
> 	at java.net.Socket.connect(Unknown Source)
> 	at
> org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:484)
> 	at
(Continue reading)

archana saini | 23 Jan 16:51 2011
Picon

Re: Not able to start connection with ActiveMQ broker from a network client.


Hi Tim,

I am not sure if it is network issue, i am able to access the same server
from my local. I can telnet and ping that server.

Any idea?

Regards
Archana
--

-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Not-able-to-start-connection-with-ActiveMQ-broker-from-a-network-client-tp3232550p3232651.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Timothy Bish | 23 Jan 17:32 2011
Picon

Re: Not able to start connection with ActiveMQ broker from a network client.

On Sun, 2011-01-23 at 07:51 -0800, archana saini wrote:
> Hi Tim,
> 
> I am not sure if it is network issue, i am able to access the same server
> from my local. I can telnet and ping that server.
> 
> Any idea?
> 
> Regards
> Archana

What does you broker configuration look like (activemq.xml)?

--

-- 
Tim Bish
------------
FuseSource
Email: tim.bish@...
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/

archana saini | 23 Jan 17:48 2011
Picon

Re: Not able to start connection with ActiveMQ broker from a network client.


Here is the content of activemq.xml

<!-- START SNIPPET: example -->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">  

    <!-- Allows us to use system properties as variables in this
configuration file -->
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.base}/conf/credentials.properties</value>
        </property>      
    </bean>

    <broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" dataDirectory="${activemq.base}/data"
destroyApplicationContextOnStop="true">

        <!-- Destination specific policies using destination names or
wildcards -->
        <destinationPolicy>
            <policyMap>
(Continue reading)

Timothy Bish | 23 Jan 18:05 2011
Picon

Re: Not able to start connection with ActiveMQ broker from a network client.

On Sun, 2011-01-23 at 08:48 -0800, archana saini wrote:
> Here is the content of activemq.xml
> 
> <!-- START SNIPPET: example -->
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:amq="http://activemq.apache.org/schema/core"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core.xsd">  
>   
>     <!-- Allows us to use system properties as variables in this
> configuration file -->
>     <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>         <property name="locations">
>             <value>file:${activemq.base}/conf/credentials.properties</value>
>         </property>      
>     </bean>
> 
>     <broker xmlns="http://activemq.apache.org/schema/core"
> brokerName="localhost" dataDirectory="${activemq.base}/data"
> destroyApplicationContextOnStop="true">
> 
>         <!-- Destination specific policies using destination names or
> wildcards -->
>         <destinationPolicy>
>             <policyMap>
(Continue reading)

archana saini | 1 Feb 13:13 2011
Picon

Re: Not able to start connection with ActiveMQ broker from a network client.


Thanks Tim. It worked for me.

Thanks for your help!

Regards
Archana
--

-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Not-able-to-start-connection-with-ActiveMQ-broker-from-a-network-client-tp3232550p3251060.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Gmane