2015-04-23 77 views
0

我想從我的mongooseim服務器與rabbitmq服務器通信。首先,我將rabbitmq-client庫(用於erlang)複製到我的apps目錄中,更新了我的makefile,然後重新編譯了mongooseim代碼。 (根據here的說明)。這樣我就可以編譯沒有錯誤的代碼,並且可以看到amqp_client已從mongooseim控制檯啓動。現在,當我嘗試從控制檯運行amqp_connection:start()時,出現以下錯誤。如何解決這個問題?從MongooseIM連接到RabbitMQ服務器

([email protected])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) 
([email protected])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 

回答

1

的是undef錯誤消息告訴我們,rabbit_net模塊或connection_string功能缺失和rabbit_netrabbit_common包的一部分。我想你沒有加rabbit_common。您可以在上一個問題中粘貼的網站上找到該軟件包 - here。重複步驟rabbit_common.ez,它應該工作。