You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by j0llyr0g3r <ti...@wincor-nixdorf.com> on 2008/04/28 14:29:46 UTC

Standard http-connector example not working?

Hey folks, 

i am having a hard time figuring out how to get http-tunneling working.

According to the documentation from here:
http://activemq.apache.org/http-and-https-transports-reference.html

this should be quite easy.

Ok, so i set up broker "1" nice and easy (one inbound connector for
jms-clients, one http for the other broker and one http for the
network-connection):

    <transportConnectors>
       <transportConnector name="inbound_openwire"
uri="tcp://localhost:61616"/>
       <transportConnector name="inbound_http"    
uri="http://localhost:61617"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector name="outbound_http"
uri="static://(http://esf-proto-2:61617)?trace=true" networkTTL="5"/>
    </networkConnectors>

Broker 2:

    <transportConnectors>
       <transportConnector name="inbound_openwire"
uri="tcp://localhost:61616"/>
       <transportConnector name="inbound_http"    
uri="http://localhost:61617"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector name="outbound_http"
uri="static://(http://esf-proto-1:61617)?trace=true" networkTTL="5"/>

    </networkConnectors>

As far as i can tell, this should work.....

Unfortunately, it doesn't.

Both brokers tell me on start-up:

WARN  DiscoveryNetworkConnector      - Could not start network bridge
between: vm://localhost and: http://esf-proto-1:61617 due to:
java.net.ConnectException: Connection refused
INFO  DemandForwardingBridge         - localhost bridge to Unknown stopped
INFO  DiscoveryNetworkConnector      - Establishing network connection
between from vm://localhost to http://esf-proto-1:61617


Now you could say that i obviously have some kind of typo or something like
that in my configuration, BUT:

If i exchange http with tcp:

s/http/tcp/g

in the above shown configuration, everything works fine.

So this is definitely a http-issue and not an error in my configuration.

What am i doing wrong?

The error message is confusing......

Has anybody a working configuration with http?

I read in a mailing-list posting that AMQ uses jetty for http-traffic ( not
only for the admin console) but i am not sure about that....

Any ideas?

-- 
View this message in context: http://www.nabble.com/Standard-http-connector-example-not-working--tp16937377s2354p16937377.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Standard http-connector example not working?

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Solved!

<transportConnector name="inbound_http"     uri="http://0.0.0.0:61617"/>

Then everything works as expected!

But why is this?

Isn't this a bug in the tcp-connector, since

tcp://localhost:61617

should be limited to calls from localhost only?

Why can i connect to tcp-connectors which run on 

tcp://localhost:61617

from everywhere, but not to http-connectors?

I think something is wrong here......
-- 
View this message in context: http://www.nabble.com/Standard-http-connector-example-not-working--tp16937377s2354p16960261.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Standard http-connector example not working?

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Hey folks, 

i found the cause for this error, but so far no solution.

I looked at the output from netstat again:

netstat -tulpen | grep 6161
tcp        0      0 :::61616                :::*                    LISTEN     
1011       70984032   1510/java          
tcp        0      0 127.0.0.1:61617         :::*                    LISTEN     
1011       70984056   1510/java 

As you can see, the connector only accepts connections from localhost
(127.0.0.1:61617)

Ok, 

now i know what causes the problem, but why behaves activemq like this?

This only happens when starting the connector with http, not with tcp or
something else.

How can i change this behaviour?
-- 
View this message in context: http://www.nabble.com/Standard-http-connector-example-not-working--tp16937377s2354p16943796.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Standard http-connector example not working?

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Hi Joe,

i don't think that this is a firewall issue.

Before i start the two brokers

 netstat -tulpen | grep 6161

shows nothing.

After starting activemq netstat shows:

netstat -tulpen | grep 6161
tcp        0      0 :::61616                :::*                    LISTEN     
1011       70984032   1510/java           
tcp        0      0 127.0.0.1:61617         :::*                    LISTEN     
1011       70984056   1510/java 

Now i check if i can reach broker 2 via telnet from broker 1 on the exact
same port:

 telnet esf-proto-1 61617
Trying 172.18.154.26...
telnet: connect to address 172.18.154.26: Connection refused


So far, this would confirm your assumption, BUT if change http to tcp, the
exact same telnet request works:

 telnet esf-proto-1 61617
Trying 172.18.154.26...
Connected to esf-proto-1.
Escape character is '^]'.
�ActiveMQ�   CacheSize
                         
CacheEnabledSizePrefixDisabledTcpNoDelayEnabledMaxInactivityDurationu0TightEncodingEnabledStackTraceEnabled^]
Connection closed by foreign host.


Then i switched on the highest debug-level in the broker, but none of the
messages seem to be of any informative value:


INFO  DiscoveryNetworkConnector      - Establishing network connection
between from vm://localhost to http://esf-proto-2:61617
...........
WARN  DiscoveryNetworkConnector      - Could not start network bridge
between: vm://localhost and: http://esf-proto-2:61617 due to:
java.net.ConnectException: Connection refused
...........
Connection refused
java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:519)
        at java.net.Socket.connect(Socket.java:469)
        at java.net.Socket.<init>(Socket.java:366)
        at java.net.Socket.<init>(Socket.java:180)
        at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:86)
        at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:651)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:628)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:497)
        at
org.apache.activemq.transport.http.HttpClientTransport.doStart(HttpClientTransport.java:181)
        at
org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:48)
        at
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:56)
        at
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:56)
        at
org.apache.activemq.network.DemandForwardingBridgeSupport.start(DemandForwardingBridgeSupport.java:207)
        at
org.apache.activemq.network.DiscoveryNetworkConnector.onServiceAdd(DiscoveryNetworkConnector.java:101)
        at
org.apache.activemq.transport.discovery.simple.SimpleDiscoveryAgent$1.run(SimpleDiscoveryAgent.java:161)

Furthermore, i can exclude any kind of firewall between the two machines.


Any more ideas?
-- 
View this message in context: http://www.nabble.com/Standard-http-connector-example-not-working--tp16937377s2354p16940962.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Standard http-connector example not working?

Posted by ttmdev <jo...@ttmsolutions.com>.
I have two 5.1 brokers connecting okay over http transports. Could it be a
firewall-related issue? 

Joe
Goto www.ttmsolutions.com for a free ActiveMQ user guide



j0llyr0g3r wrote:
> 
> Hey folks, 
> 
> i am having a hard time figuring out how to get http-tunneling working.
> 
> According to the documentation from here:
> http://activemq.apache.org/http-and-https-transports-reference.html
> 
> this should be quite easy.
> 
> Ok, so i set up broker "1" nice and easy (one inbound connector for
> jms-clients, one http for the other broker and one http for the
> network-connection):
> 
>     <transportConnectors>
>        <transportConnector name="inbound_openwire"
> uri="tcp://localhost:61616"/>
>        <transportConnector name="inbound_http"    
> uri="http://localhost:61617"/>
>     </transportConnectors>
> 
>     <networkConnectors>
>       <networkConnector name="outbound_http"
> uri="static://(http://esf-proto-2:61617)?trace=true" networkTTL="5"/>
>     </networkConnectors>
> 
> Broker 2:
> 
>     <transportConnectors>
>        <transportConnector name="inbound_openwire"
> uri="tcp://localhost:61616"/>
>        <transportConnector name="inbound_http"    
> uri="http://localhost:61617"/>
>     </transportConnectors>
> 
>     <networkConnectors>
>       <networkConnector name="outbound_http"
> uri="static://(http://esf-proto-1:61617)?trace=true" networkTTL="5"/>
> 
>     </networkConnectors>
> 
> As far as i can tell, this should work.....
> 
> Unfortunately, it doesn't.
> 
> Both brokers tell me on start-up:
> 
> WARN  DiscoveryNetworkConnector      - Could not start network bridge
> between: vm://localhost and: http://esf-proto-1:61617 due to:
> java.net.ConnectException: Connection refused
> INFO  DemandForwardingBridge         - localhost bridge to Unknown stopped
> INFO  DiscoveryNetworkConnector      - Establishing network connection
> between from vm://localhost to http://esf-proto-1:61617
> 
> 
> Now you could say that i obviously have some kind of typo or something
> like that in my configuration, BUT:
> 
> If i exchange http with tcp:
> 
> s/http/tcp/g
> 
> in the above shown configuration, everything works fine.
> 
> So this is definitely a http-issue and not an error in my configuration.
> 
> What am i doing wrong?
> 
> The error message is confusing......
> 
> Has anybody a working configuration with http?
> 
> I read in a mailing-list posting that AMQ uses jetty for http-traffic (
> not only for the admin console) but i am not sure about that....
> 
> Any ideas?
> 
> 

-- 
View this message in context: http://www.nabble.com/Standard-http-connector-example-not-working--tp16937377s2354p16939141.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.