0

我正在尝试从我的 mongooseim 服务器与 rabbitmq 服务器通信。为此,我首先将 rabbitmq-client 库(用于 erlang)复制到了我的应用程序目录,更新了我的 makefile,然后重新编译了 mongooseim 代码。(根据此处的说明)。这样我就可以毫无错误地编译代码,并且可以看到 amqp_client 已从 mongooseim 控制台启动。现在,当我尝试从控制台运行 amqp_connection:start() 时,出现以下错误。如何解决这个问题?

(mongooseim@localhost)8> {ok, Connection} = amqp_connection:start(#amqp_params_network{}).
2015-04-23 15:07:27.320 [debug] <0.790.0> Supervisor {<0.790.0>,amqp_connection_sup} started amqp_connection_type_sup:start_link() at pid <0.791.0>
2015-04-23 15:07:27.324 [debug] <0.790.0> Supervisor {<0.790.0>,amqp_connection_sup} started amqp_gen_connection:start_link(<0.791.0>, {amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,none,[#Fun<amq..>,...],...}) at pid <0.792.0>
** exception exit: {{function_clause,[{amqp_gen_connection,terminate,
                                                           [{undef,[{rabbit_net,connection_string,
                                                                                [#Port<0.6063>,outbound],
                                                                                []},
                                                                    {amqp_network_connection,try_handshake,3,[]},
                                                                    {amqp_gen_connection,handle_call,3,[]},
                                                                    {gen_server,try_handle_call,4,
                                                                                [{file,"gen_server.erl"},{line,607}]},
                                                                    {gen_server,handle_msg,5,
                                                                                [{file,"gen_server.erl"},{line,639}]},
                                                                    {proc_lib,init_p_do_apply,3,
                                                                              [{file,"proc_lib.erl"},{line,237}]}]},
                                                            {<0.791.0>,
                                                             #amqp_params_network{username = <<"guest">>,
                                                                                  password = <<"guest">>,virtual_host = <<"/">>,
                                                                                  host = "localhost",port = 5672,channel_max = 0,
                                                                                  frame_max = 0,heartbeat = 0,connection_timeout = infinity,
                                                                                  ssl_options = none,
                                                                                  auth_mechanisms = [#Fun<amqp_auth_mechanisms.plain.3>,
                                                                                                     #Fun<amqp_auth_mechanisms.amqplain.3>],
                                                                                  client_properties = [],socket_options = []}}],
                                                           []},
                                      {gen_server,try_terminate,3,
                                                  [{file,"gen_server.erl"},{line,621}]},
                                      {gen_server,terminate,7,
                                                  [{file,"gen_server.erl"},{line,787}]},
                                      {proc_lib,init_p_do_apply,3,
                                                [{file,"proc_lib.erl"},{line,237}]}]},
                    {gen_server,call,[<0.792.0>,connect,infinity]}}
     in function  gen_server:call/3 (gen_server.erl, line 190)
(mongooseim@localhost)9> 2015-04-23 15:07:27.411 [error] <0.792.0> gen_server <0.792.0> terminated with reason: no function clause matching amqp_gen_connection:terminate({undef,[{rabbit_net,connection_string,[#Port<0.6063>,outbound],[]},{amqp_network_connection,try_handshake,...},...]}, {<0.791.0>,{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,...}})
2015-04-23 15:07:27.412 [error] <0.792.0> CRASH REPORT Process <0.792.0> with 0 neighbours exited with reason: no function clause matching amqp_gen_connection:terminate({undef,[{rabbit_net,connection_string,[#Port<0.6063>,outbound],[]},{amqp_network_connection,try_handshake,...},...]}, {<0.791.0>,{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,...}}) in gen_server:terminate/7 line 792
2015-04-23 15:07:27.414 [error] <0.790.0> Supervisor {<0.790.0>,amqp_connection_sup} had child connection started with amqp_gen_connection:start_link(<0.791.0>, {amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,none,[#Fun<amq..>,...],...}) at <0.792.0> exit with reason no function clause matching amqp_gen_connection:terminate({undef,[{rabbit_net,connection_string,[#Port<0.6063>,outbound],[]},{amqp_network_connection,try_handshake,...},...]}, {<0.791.0>,{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,...}}) in context child_terminated
2015-04-23 15:07:27.416 [error] <0.790.0> Supervisor {<0.790.0>,amqp_connection_sup} had child connection started with amqp_gen_connection:start_link(<0.791.0>, {amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,none,[#Fun<amq..>,...],...}) at <0.792.0> exit with reason reached_max_restart_intensity in context shutdown
4

1 回答 1

1

undef 错误消息告诉我们rabbit_net模块或connection_string函数丢失并且rabbit_netrabbit_common包的一部分。我猜你没有添加rabbit_common. 您可以在上一个问题中粘贴的网站上找到该包 -此处。重复这些步骤,rabbit_common.ez它应该可以工作。

于 2015-04-24T05:35:04.457 回答