[rabbitmq-discuss] JSONRPCError - Internal error: badmatch

21 views
Skip to first unread message

Cameron Harris

unread,
Aug 4, 2010, 11:06:05 AM8/4/10
to rabbitmq...@lists.rabbitmq.com
Hi all,

I've installed rabbitmq on OS X 10.6 via MacPorts, and built and
installed the rabbitmq-jsonrpc, rabbitmq-jsonrpc-channel, mochiweb,
rabbitmq-mochiweb, rfc4627_jsonrpc plugins.

After installing, I went to the example page on localhost:55672, and
clicked the Simple JSONRPC test. I get the following output:

test_main
{"installGenericProxy":{"name":"open","idempotent":false,"params":
[{"name":"username","type":"str"},{"name":"password","type":"str"},
{"name":"sessionTimeout","type":"num"},
{"name":"virtualHost","type":"str"}]}}
open
JsonRPC error:
Service: "/rpc/rabbitmq"
Method: "open"
Params: ["guest","guest",5,null]
Response: {"version":"1.1","id":2,"error":
{"name":"JSONRPCError","code":500,"message":"Internal
error","error":"{{{badmatch,{error,{{badmatch,<0.13932.0>},
                   [{rabbit_jsonrpc_channel,init,1},
                    {gen_server,init_it,6},
                    {proc_lib,init_p_do_apply,3}]}}},
 [{rabbit_jsonrpc_channel,open,1},
  {rabbit_jsonrpc_channel_factory,handle_call,3},
  {gen_server,handle_msg,5},
  {proc_lib,init_p_do_apply,3}]},
 {gen_server,call,
            [<0.8986.0>,
             {jsonrpc,<<\"open\">>,
                      {obj,[{\"http_method\",<<\"POST\">>},
                            {\"http_query_parameters\",{obj,[]}},
                            {\"http_headers\",
                             {obj,[{\"accept\",<<\"*/*\">>},
                                   {\"accept-charset\",<<\"ISO-8859-1,utf-8;q=0.7,*;q=0.7\">>},
                                   {\"accept-encoding\",<<\"gzip,deflate\">>},
                                   {\"accept-language\",<<\"en-us,en;q=0.5\">>},
                                   {\"cache-control\",<<\"no-cache\">>},
                                   {\"connection\",<<\"keep-alive\">>},
                                   {\"content-length\",<<\"74\">>},
                                   {\"content-type\",<<\"application/json;charset=UTF-8\">>},
                                   {\"host\",<<\"localhost:55672\">>},
                                   {\"keep-alive\",<<\"115\">>},
                                   {\"pragma\",<<\"no-cache\">>},
                                   {\"referer\",<<\"http://localhost:55672/rabbitmq_lib/www-examples/test/index.html\">>},
                                   {\"user-agent\",<<\"Mozilla/5.0 (Macintosh; IntelMac OS X 10.6; rv:2.0b3pre) Gecko/20100729 Minefield/4.0b3pre\">>},
                                   {\"x-json-rpc-timeout\",<<\"30000\">>},
                                   {\"x-requested-with\",<<\"XMLHttpRequest\">>}]}},
                            {\"remote_peername\",<<\"127.0.0.1\">>},
                            {\"scheme\",<<\"http\">>}]},
                      [<<\"guest\">>,<<\"guest\">>,5,null]},
             30000]}}"}}
-------

The broker has started without any errors and appears to be
functioning, and when I tried the rabbitmq-status plugin, that worked
fine.

My rabbitmqctl status is:
Status of node rabbit@Bilbo ...
[{running_applications,
    [{rabbit_jsonrpc_channel,"RabbitMQ JSON-RPC Channels","0.01"},
     {rabbit,"RabbitMQ","1.8.1"},
     {os_mon,"CPO  CXC 138 46","2.2.5"},
     {sasl,"SASL  CXC 138 11","2.1.9.2"},
     {rfc4627_jsonrpc,"JSON RPC Service","0.01"},
     {rabbit_jsonrpc,"Rabbit JSON-RPC","0.01"},
     {rabbit_mochiweb,"RabbitMQ Mochiweb Embedding","0.01"},
     {mochiweb,"MochiMedia Web Server","1.3"},
     {crypto,"CRYPTO version 2","2.0"},
     {inets,"INETS  CXC 138 49","5.4"},
     {mnesia,"MNESIA  CXC 138 12","4.4.14"},
     {stdlib,"ERTS  CXC 138 10","1.17"},
     {kernel,"ERTS  CXC 138 10","2.14"}]},
 {nodes,[{disc,[rabbit@Bilbo]}]},
 {running_nodes,[rabbit@Bilbo]}]
...done.

Thanks,
Cameron

Simon MacMullen

unread,
Aug 5, 2010, 6:35:14 PM8/5/10
to rabbitmq...@lists.rabbitmq.com
Hi Cameron.

I think you're trying to use a too-new version of
rabbitmq-jsonrpc-channel. I haven't tested, but I think revision
0a920cb5180b is more likely to work with RabbitMQ 1.8.1. Or you could
build the server from default as well as the plugins.

Cheers, Simon

> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq...@lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq...@lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Cameron Harris

unread,
Aug 6, 2010, 12:05:19 PM8/6/10
to rabbitmq...@lists.rabbitmq.com
I was running 1.8.1...

Anyway, I've reinstalled now, on Ubuntu Linux 10.04 this time. I built
everything from the umbrella.

Now I'm getting a different problem on the examples:

test_main
{"installGenericProxy":{"name":"open","idempotent":false,"params":
[{"name":"username","type":"str"},{"name":"password","type":"str"},
{"name":"sessionTimeout","type":"num"},
{"name":"virtualHost","type":"str"}]}}
open

{"installGenericProxy":{"name":"poll","idempotent":false,"params":[]}}
{"installGenericProxy":{"name":"close","idempotent":false,"params":
[]}}
{"installGenericProxy":{"name":"call","idempotent":false,"params":
[{"name":"method","type":"str"},{"name":"args","type":"arr"}]}}
{"installGenericProxy":{"name":"cast","idempotent":false,"params":
[{"name":"method","type":"str"},{"name":"args","type":"arr"},
{"name":"content","type":"str"},{"name":"props","type":"arr"}]}}
handle_channel_ready
{"q2":"test-queue-1b"}
{"q1":"test-queue-1a"}
JsonRPC error:
Service: "/rpc/8DCB5AAAE542E25A84F64EE11A1398E1"
Method: "call"
Params: ["basic.consume",[0,"test-queue-1a","aa-cons-
tag1",false,false,false,false]]
Response: {"version":"1.1","id":8,"error":


{"name":"JSONRPCError","code":500,"message":"Internal

error","error":"{noproc,
{gen_server,call,
[<0.875.0>,
{jsonrpc,<<\"call\">>,


{obj,
[{\"http_method\",<<\"POST\">>},
{\"http_query_parameters\",{obj,[]}},
{\"http_headers\",
{obj,
[{\"accept\",<<\"*/*\">>},
{\"accept-charset\",
<<\"ISO-8859-1,utf-8;q=0.7,*;q=0.7\">>},

{\"accept-encoding\",<<\"gzip, deflate\">>},


{\"accept-language\",<<\"en-us,en;q=0.5\">>},
{\"cache-control\",<<\"no-cache\">>},
{\"connection\",<<\"keep-alive\">>},

{\"content-length\",<<\"126\">>},


{\"content-type\",<<\"application/json;
charset=UTF-8\">>},

{\"host\",<<\"vmrab1:55672\">>},


{\"keep-alive\",<<\"115\">>},
{\"pragma\",<<\"no-cache\">>},
{\"referer\",

<<\"http://vmrab1:55672/rabbitmq_lib/www-
examples/test/index.html\">>},
{\"user-agent\",
<<\"Mozilla/5.0 (Windows; Windows NT 6.1;
WOW64; rv:2.0b3pre) Gecko/20100801 Minefield/4.0b3pre ( .NET CLR
3.5.30729; .NET4.0E)\">>},
{\"x-json-rpc-timeout\",<<\"5000\">>},
{\"x-requested-with\",<<\"XMLHttpRequest
\">>}]}},
{\"remote_peername\",<<\"172.20.5.26\">>},
{\"scheme\",<<\"http\">>}]},
[<<\"basic.consume\">>,
[0,<<\"test-queue-1a\">>,<<\"aa-cons-
tag1\">>,false,false,false,
false]]},
5000]}}"}}
JsonRPC error:
Service: "/rpc/8DCB5AAAE542E25A84F64EE11A1398E1"
Method: "call"
Params: ["basic.consume",[0,"test-
queue-1b","",false,false,false,false]]
Response: {"version":"1.1","id":7,"error":
{"name":"JSONRPCError","code":500,"message":"AMQP error","error":
{"code":"command_invalid","text":"unimplemented
method","method":"basic.consume"}}}

"unimplemented method"?
My rabbitmqctl status is:
Status of node rabbit@vmrab1 ...


[{running_applications,
[{rabbit_jsonrpc_channel,"RabbitMQ JSON-RPC Channels","0.01"},

{rabbit,"RabbitMQ","%%VSN%%"},
{os_mon,"CPO CXC 138 46","2.2.4"},
{sasl,"SASL CXC 138 11","2.1.8"},


{rabbit_jsonrpc,"Rabbit JSON-RPC","0.01"},
{rfc4627_jsonrpc,"JSON RPC Service","0.01"},
{rabbit_mochiweb,"RabbitMQ Mochiweb Embedding","0.01"},
{mochiweb,"MochiMedia Web Server","1.3"},

{crypto,"CRYPTO version 1","1.6.3"},
{inets,"INETS CXC 138 49","5.2"},
{mnesia,"MNESIA CXC 138 12","4.4.12"},
{stdlib,"ERTS CXC 138 10","1.16.4"},
{kernel,"ERTS CXC 138 10","2.13.4"}]},
{nodes,[{disc,[rabbit@vmrab1]}]},
{running_nodes,[rabbit@vmrab1]}]
...done.


The queues are being created, however:

$ scripts/rabbitmqctl list_queues
Listing queues ...
test-queue-1b 0
amq.gen-CDzvGz+lPWtoz5uOQz1wMA== 0
test-queue-1a 0
amq.gen-VKcoc8C1V6yxQ2f2Nj/sEg== 0
...done.


Also, not sure if I'm doing something wrong, but to get to the example
pages, I have to copy them from priv/www-examples to priv/www then
access them using the URL /rabbitmq_lib/www-examples. This happened on
both Ubuntu and OS X. The paths in the README just return 404 Not
Found.

Thanks,
Cameron

> > rabbitmq-disc...@lists.rabbitmq.com


> >https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
> _______________________________________________
> rabbitmq-discuss mailing list

> rabbitmq-disc...@lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Marek Majkowski

unread,
Aug 11, 2010, 12:41:25 PM8/11/10
to Cameron Harris, rabbitmq...@lists.rabbitmq.com
Cameron,

It appears that rabbitmq-jsonrpc-channel had outdated signature for
basic.consume. We've fixed that in the default branch.

Could you try again, and let us know if the new code works better?

Cheers,
Marek

Cameron Harris

unread,
Aug 12, 2010, 6:27:24 AM8/12/10
to Marek Majkowski, rabbitmq...@lists.rabbitmq.com
Hi Marek,

That has fixed the issue when building from scratch, thanks.

However, we would like to get it working in 1.8.1 if possible. I've tried checking out the revision of rabbitmq-jsonrpc-channel that Simon suggested most likely to work with 1.8.1 (0a920cb5180b) and loaded it into the 1.8.1 release version of rabbitmq, along with the head versions of rfc4627_jsonrpc, rabbit_jsonrpc, rabbit_mochiweb, mochiweb. Unfortunately this gives me the error I reported in my first post.

I tried building rabbitmq-server tag 1.8.1, but I got errors relating to what files were available in rabbit-codegen, and rabbit-codegen only has a 1.8.0 tag. Many of the other plugins aren't tagged for 1.8.1, so is using the head version of those likely to cause a problem? Most of the comments on the commits also reference bug numbers.. is there a public bug tracker anywhere so that I can work out what the commits are for?


On a more interesting, related note: is there any way of writing javascript that runs on a seperate webserver that connects to the rabbitmq-server's json-rpc? I'm guessing either you could use JSONP, or in standards compliant browsers, you'd need to use CORS/XHR2, and IE would need to use XDomainRequest (which needs support in the javascript lib doesn't it?). Has this issue been considered yet? To do CORS and JSONP would both require support in the web server, wouldn't they?

Thanks,
Cameron Harris

Marek Majkowski

unread,
Aug 13, 2010, 8:16:09 AM8/13/10
to Cameron Harris, rabbitmq...@lists.rabbitmq.com
On Thu, Aug 12, 2010 at 11:27, Cameron Harris <cam...@cameronharris.org> wrote:
> That has fixed the issue when building from scratch, thanks.
>
> However, we would like to get it working in 1.8.1 if possible. I've tried
> checking out the revision of rabbitmq-jsonrpc-channel that Simon suggested
> most likely to work with 1.8.1 (0a920cb5180b) and loaded it into the 1.8.1
> release version of rabbitmq, along with the head versions of
> rfc4627_jsonrpc, rabbit_jsonrpc, rabbit_mochiweb, mochiweb. Unfortunately
> this gives me the error I reported in my first post.
>
> I tried building rabbitmq-server tag 1.8.1, but I got errors relating to
> what files were available in rabbit-codegen, and rabbit-codegen only has a
> 1.8.0 tag. Many of the other plugins aren't tagged for 1.8.1, so is using
> the head version of those likely to cause a problem? Most of the comments on
> the commits also reference bug numbers.. is there a public bug tracker
> anywhere so that I can work out what the commits are for?

The bug tracker is not public at the moment.
I'm afraid I'm not able to assist you with building the plugins for 1.8.1.
Instead, I'd ask you to give us some time. On the next release
(which should happen pretty soon) all the plugins will be correctly
tagged and hopefully working.


> On a more interesting, related note: is there any way of writing javascript
> that runs on a seperate webserver that connects to the rabbitmq-server's
> json-rpc?

That is a very valid question. From my knowledge no one has ever tried
to use these plugins in production.

If anyone has - please shout now!


> I'm guessing either you could use JSONP, or in standards compliant
> browsers, you'd need to use CORS/XHR2, and IE would need to use
> XDomainRequest (which needs support in the javascript lib doesn't it?). Has
> this issue been considered yet? To do CORS and JSONP would both require
> support in the web server, wouldn't they?

I did heard of the solution to this problem via iframe hack, but it's all messy.

On the other hand there seem to be few projects that try to do 'comet'
things via a hosted service. For example http://pusherapp.com/.

What problem are you actually trying to solve via rabbitmq-jsonrpc-channel?

Cheers,
Marek

Emile Joubert

unread,
Aug 13, 2010, 9:24:38 AM8/13/10
to Cameron Harris, rabbitmq...@lists.rabbitmq.com

Hi Cameron,

On 12/08/10 11:27, Cameron Harris wrote:
> Hi Marek,
>

> I tried building rabbitmq-server tag 1.8.1, but I got errors relating to
> what files were available in rabbit-codegen, and rabbit-codegen only has
> a 1.8.0 tag.

Thanks for pointing that out - a 1.8.1 tag has been added to the
rabbitmq-codegen repository, which will show as soon as you perform a
refresh.


Emile

Reply all
Reply to author
Forward
0 new messages