2012-12-18 67 views
2

我成功使用簡單的Hello World rebarized和OTP「兼容」應用程序的rabbitmq-erlang-client的鋼筋友好包,事情在開發環境中工作得很好。我可以啓動erl控制檯並執行我的application:start(helloworld).並連接到代理,打開一個通道並與隊列通信。rabbitmq-erlang-client,使用鋼筋友好pkg,在開發環境下工作,env失敗,鋼筋釋放

但是,我繼續做rebar generate,它構建的版本很好,但是當我試圖從自包含的發佈包中啓動時,事情突然爆炸了。

我知道rebar版本被稱爲一個晦澀難懂的藝術,但我想知道我的選擇,爲使用rabbitmq-erlang-client應用程序部署。

下面你會發現控制檯上崩潰的輸出:

=INFO REPORT==== 18-Dec-2012::16:41:35 === 
    application: session_record 
    exited: {{{badmatch, 
       {error, 
       {'EXIT', 
       {undef, 
        [{amqp_connection_sup,start_link, 
        [{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>, 
         "127.0.0.1",5672,0,0,0,infinity,none, 
         [#Fun<amqp_auth_mechanisms.plain.3>, 
         #Fun<amqp_auth_mechanisms.amqplain.3>], 
         [],[]}], 
        []}, 
        {supervisor2,do_start_child_i,3, 
        [{file,"src/supervisor2.erl"},{line,391}]}, 
        {supervisor2,handle_call,3, 
        [{file,"src/supervisor2.erl"},{line,413}]}, 
        {gen_server,handle_msg,5, 
        [{file,"gen_server.erl"},{line,588}]}, 
        {proc_lib,init_p_do_apply,3, 
        [{file,"proc_lib.erl"},{line,227}]}]}}}}, 
       [{amqp_connection,start,1, 
       [{file,"src/amqp_connection.erl"},{line,164}]}, 
       {hello_qp,start_link,0,[{file,"src/hello_qp.erl"},{line,10}]}, 
       {session_record_sup,init,1, 
       [{file,"src/session_record_sup.erl"},{line,55}]}, 
       {supervisor_bridge,init,1, 
       [{file,"supervisor_bridge.erl"},{line,79}]}, 
       {gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]}, 
       {proc_lib,init_p_do_apply,3, 
       [{file,"proc_lib.erl"},{line,227}]}]}, 
      {session_record_app,start,[normal,[]]}} 
    type: permanent {"Kernel pid terminated",application_controller 

編輯:正如意見中的要求。

reltool.config

{sys, [ 
     {lib_dirs, ["..", "../deps"]}, 
     {erts, [{mod_cond, derived}, {app_file, strip}]}, 
     {app_file, strip}, 
     {rel, "session_record", "0.1.0", 
     [ 
     kernel, 
     stdlib, 
     sasl, 
     session_record 
     ]}, 
     {rel, "start_clean", "", 
     [ 
     kernel, 
     stdlib 
     ]}, 
     {boot_rel, "session_record"}, 
     {profile, embedded}, 
     {incl_cond, derived}, 
     {mod_cond, derived}, 
     {excl_archive_filters, [".*"]}, %% Do not archive built libs 
     {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)", 
          "^erts.*/(doc|info|include|lib|man|src)"]}, 
     {excl_app_filters, ["\.gitignore"]}, 
     {app, session_record, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]}, 
     {app, hipe, [{incl_cond, exclude}]} 
     ]}. 

{target_dir, "session_record"}. 

{overlay, [ 
      {mkdir, "log/sasl"}, 
      {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, 
      {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"}, 
      {copy, "files/session_record", "bin/session_record"}, 
      {copy, "files/session_record.cmd", "bin/session_record.cmd"}, 
      {copy, "files/start_erl.cmd", "bin/start_erl.cmd"}, 
      {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"}, 
      {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"}, 
      {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"} 
      ]}. 
+0

你能發佈你的'reltool.config'文件嗎? – kjw0188

+0

@ kjw0188我發佈了請求的配置文件,奇怪的是,生成發佈版本並不會失敗,並且似乎失敗的代碼是在打開連接時從amqp_client發出的。我將rabbitmq服務器a.s.o上的所有網絡設置都檢查了三次。感謝您的幫助 – lfurrea

+0

生成發佈版本只是移動文件,因此您的版本可能不包括amqp客戶端,從而導致未定義的錯誤。 – kjw0188

回答

2

嘗試改變{mod_cond, derived}{mod_cond, all}。這意味着reltool不會試圖從包含的應用程序中挑選哪些模塊。我懷疑你的問題是reltool沒有考慮amqp_connection_sup是必要的;你可以通過檢查它是否存在於lib/amqp_client-0.8/ebin中來確認。

+0

你明白了!非常感謝你! – lfurrea

0

@legoscia給出的答案工作。 這裏是示例,reltool.config

%% -*- mode: erlang -*- 
%% ex: ft=erlang 
{sys, [ 
     {lib_dirs, ["..","../deps"]}, 
     {erts, [{mod_cond, all}, {app_file, strip}]}, 
     {app_file, strip}, 
     {rel, "chat_grabber", "1", 
     [ 
     kernel, 
     stdlib, 
     sasl, 
      couchbeam, 
     chat_grabber 
     ]}, 
     {rel, "start_clean", "", 
     [ 
     kernel, 
     stdlib 
     ]}, 
     {boot_rel, "chat_grabber"}, 
     {profile, embedded}, 
     {incl_cond, derived}, 
     {excl_archive_filters, [".*"]}, %% Do not archive built libs 
     {excl_sys_filters, ["^bin/(?!start_clean.boot)", 
          "^erts.*/bin/(dialyzer|typer)", 
          "^erts.*/(doc|info|include|lib|man|src)"]}, 
     {excl_app_filters, ["\.gitignore"]}, 
     {app,couchbeam,[{mod_cond,app},{incl_cond,include},{lib_dir, "../deps/"}]}, 
     {app, chat_grabber, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]} 
     ]}. 

{target_dir, "chat_grabber"}. 

{overlay, [ 
      {mkdir, "log/sasl"}, 
      {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, 
      {copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"}, 
      {copy, "chat_grabber/bin/start_clean.boot", 
        "\{\{erts_vsn\}\}/bin/start_clean.boot"}, 
      {copy, "files/chat_grabber", "bin/chat_grabber"}, 
      {copy, "files/chat_grabber.cmd", "bin/chat_grabber.cmd"}, 
      {copy, "files/start_erl.cmd", "bin/start_erl.cmd"}, 
      {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"}, 
      {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"}, 
      {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"} 
      ]}. 
相關問題