You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by dead_devil_66 <de...@hotmail.com> on 2011/07/25 06:35:43 UTC

Stomp causing error 500 when connecting

Greetings.

I'm just trying to run some php examples with Stomp. I have created a broker
in port 61616. But, when i try to run the connectivity.php example that
comes in the stomp bundle, i get an 500 error. To be more precise, an error
in this line:

        $frame = $this->readFrame();

Well, i think that it's that line because, after using the
ExceptionThrower.php, from 
http://code.google.com/p/phreeze/source/browse/trunk/phreeze/includes/verysimple/Util/ExceptionThrower.php?spec=svn254&r=254
this site , the Exception object says that the error is in that line.

My code:

<?php
// include a library
require_once("Stomp.php");
require_once("ExceptionThrower.php");
// make a connection
$con = new Stomp("tcp://localhost:61616");
try
{

   ExceptionThrower::Start();
   // connect
   $con->connect();
   ExceptionThrower::Stop();

}
catch (Exception $ex)
{
   ExceptionThrower::Stop();
   // handle or re-throw exception
	print_r($ex);

}

/*
// send a message to the queue
$con->send("/queue/test", "test");
echo "Sent message with body 'test'\n";
// subscribe to the queue
$con->subscribe("/queue/test");
// receive a message from the queue
$msg = $con->readFrame();

// do what you want with the message
if ( $msg != null) {
    echo "Received message with body '$msg->body'\n";
    // mark the message as received in the queue
    $con->ack($msg);
} else {
    echo "Failed to receive a message\n";
}

// disconnect
$con->disconnect();
*/
?>

--
View this message in context: http://activemq.2283324.n4.nabble.com/Stomp-causing-error-500-when-connecting-tp3691651p3691651.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Stomp causing error 500 when connecting

Posted by dead_devil_66 <de...@hotmail.com>.
Yes, that was the problem. Thanks for pointing it out. :)

--
View this message in context: http://activemq.2283324.n4.nabble.com/Stomp-causing-error-500-when-connecting-tp3691651p3694690.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Stomp causing error 500 when connecting

Posted by Dejan Bosanac <de...@nighttale.net>.
Are you sure there's a stomp transport listening on 61616, e.g.

<transportConnector uri="stomp://localhost:61616 />

in your activemq.xml


Regards
-- 
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Mon, Jul 25, 2011 at 6:35 AM, dead_devil_66 <de...@hotmail.com>wrote:

> Greetings.
>
> I'm just trying to run some php examples with Stomp. I have created a
> broker
> in port 61616. But, when i try to run the connectivity.php example that
> comes in the stomp bundle, i get an 500 error. To be more precise, an error
> in this line:
>
>        $frame = $this->readFrame();
>
> Well, i think that it's that line because, after using the
> ExceptionThrower.php, from
>
> http://code.google.com/p/phreeze/source/browse/trunk/phreeze/includes/verysimple/Util/ExceptionThrower.php?spec=svn254&r=254
> this site , the Exception object says that the error is in that line.
>
> My code:
>
> <?php
> // include a library
> require_once("Stomp.php");
> require_once("ExceptionThrower.php");
> // make a connection
> $con = new Stomp("tcp://localhost:61616");
> try
> {
>
>   ExceptionThrower::Start();
>   // connect
>   $con->connect();
>   ExceptionThrower::Stop();
>
> }
> catch (Exception $ex)
> {
>   ExceptionThrower::Stop();
>   // handle or re-throw exception
>        print_r($ex);
>
> }
>
> /*
> // send a message to the queue
> $con->send("/queue/test", "test");
> echo "Sent message with body 'test'\n";
> // subscribe to the queue
> $con->subscribe("/queue/test");
> // receive a message from the queue
> $msg = $con->readFrame();
>
> // do what you want with the message
> if ( $msg != null) {
>    echo "Received message with body '$msg->body'\n";
>    // mark the message as received in the queue
>    $con->ack($msg);
> } else {
>    echo "Failed to receive a message\n";
> }
>
> // disconnect
> $con->disconnect();
> */
> ?>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Stomp-causing-error-500-when-connecting-tp3691651p3691651.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>