Connection not acknowledged / Connection reset

View: New views
3 Messages — Rating Filter:   Alert me  

Connection not acknowledged / Connection reset

by robvoyer () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am hoping someone has seen this error before or knows what it is about.  I am trying to connect to ActiveMQ from PHP:

Fatal error: Uncaught exception 'Stomp_Exception' with message 'Connection not acknowledged' in /var/www/vservers/robv/www/htdocs/Stomp/Stomp.php:208

The activemq logs show this:

DEBUG WireFormatNegotiator           - Sending: WireFormatInfo { version=3, properties={TightEncodingEnabled=true, CacheSize=1024, TcpNoDelayEnabled=true, SizePrefixDisabled=false, StackTraceEnabled=true, MaxInactivityDurationInitalDelay=10000, MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
DEBUG Transport                      - Transport failed: java.io.IOException: Unknown data type: 99
java.io.IOException: Unknown data type: 99
       at org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(OpenWireFormat.java:356)
       at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:276)
       at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:203)
       at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:195)
       at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:183)
       at java.lang.Thread.run(Thread.java:595)
DEBUG TransportConnection            - Stopping connection: /127.0.0.1:34040
DEBUG TcpTransport                   - Stopping transport tcp:///127.0.0.1:34040
DEBUG TransportConnection            - Stopped connection: /127.0.0.1:34040
DEBUG TransportConnection            - Connection Stopped: /127.0.0.1:34040
DEBUG InactivityMonitor              - 10000 ms elapsed since last write check.

Here are some excerpts of my configuration of activemq.xml:

        <!-- The transport connectors ActiveMQ will listen to -->
        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://localhost:60616" discoveryUri="multicast://default"/>
            <transportConnector name="ssl" uri="ssl://localhost:60617"/>
            <transportConnector name="stomp" uri="stomp://localhost:60613"/>
            <transportConnector name="xmpp" uri="xmpp://localhost:60222"/>
        </transportConnectors>

<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="tcp://localhost:60616"/>
  </bean>

    <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
        <connectors>
            <nioConnector port="8061"/>
        </connectors>

        <handlers>
            <webAppContext contextPath="/admin" resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true"/>
            <webAppContext contextPath="/demo" resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true"/>
            <webAppContext contextPath="/fileserver" resourceBase="${activemq.base}/webapps/fileserver" logUrlOnStart="true"/>
            <webAppContext contextPath="/noreaster-amq" resourceBase="${activemq.base}/webapps/noreaster-amq" logUrlOnStart="true"/>
        </handlers>
    </jetty>


And here is my client config of stomp:

        require_once("Stomp/Stomp.php");

        // make a connection
        $con = new Stomp("tcp://localhost:60613");
        $topic = "/queue/EVENTS.DEMO";
        // connect
        $con->connect();

Connection not acknowledged / Connection reset

by robvoyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

By using a very new version of PHP Stomp client, I get slightly further but not much.  Here is the URL for resolving the first issue (thanks Michael):

http://groups.google.com/group/stompcli-dev/browse_thread/thread/5d6cd3b06bbebb7a

Here is the error now shown by the stomp client:

Fatal error: Uncaught exception 'Stomp_Exception' with message 'Connection not acknowledged' in /var/www/vservers/robv/www/htdocs/noreaster-client/Stomp.php:227 Stack trace: #0 /var/www/vservers/robv/www/htdocs/noreaster-client/mySStest.php(180): Stomp->connect('user', 'password') #1 {main} thrown in /var/www/vservers/robv/www/htdocs/noreaster-client/Stomp.php on line 227

The above occurs because ActiveMQ is not setting the session up and is returning false instead.   The stomp lines of code are:

        $frame = new Stomp_Frame("CONNECT", $headers);
        $this->_writeFrame($frame);
        $frame = $this->readFrame();

   Here is what $frame looks like before and after the readFrame() call:

$frame before

object(Stomp_Frame)#124 (3) {
  ["command"]=>
  string(7) "CONNECT"
  ["headers"]=>
  array(2) {
    ["login"]=>
    string(4) "user"
    ["passcode"]=>
    string(8) "password"
  }
  ["body"]=>
  NULL
}

$frame after

bool(false)


Here is what appears in the activemq.log:

DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:46203
DEBUG Transport                      - Transport failed: java.net.SocketException: Connection reset
java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:168)
        at org.apache.activemq.transport.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:50)
        at org.apache.activemq.transport.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:58)
        at java.io.DataInputStream.readByte(DataInputStream.java:241)
        at org.apache.activemq.transport.stomp.StompWireFormat.readLine(StompWireFormat.java:186)
        at org.apache.activemq.transport.stomp.StompWireFormat.unmarshal(StompWireFormat.java:94)
        at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:203)
        at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:195)
        at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:183)
        at java.lang.Thread.run(Thread.java:595)
DEBUG TransportConnection            - Stopping connection: /127.0.0.1:46203
DEBUG TcpTransport                   - Stopping transport tcp:///127.0.0.1:46203
DEBUG TransportConnection            - Stopped connection: /127.0.0.1:46203
DEBUG TransportConnection            - Cleaning up connection resources: /127.0.0.1:46203
DEBUG TransportConnection            - Connection Stopped: /127.0.0.1:46203

All of the configuration has not changed since my original message.  I am stumped as to why the connection is being reset.

Any help would be greatly appreciated.

Rob

Re: Connection not acknowledged / Connection reset

by robvoyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael suggested the following which solved my problem.  

Sounds like something funny is going on with stream_select() on line 558.  Can you retry with lines 510-512 in Stomp.php commented out?

Note that I was able to connect to my amq server from my laptop running php5.2.  The problem only appeared connecting from the server running php 5.1 to the amq server.   So the above issue may only be an issue in php5.1.

Rob