首页 文章

坚持{“init终止于do_boot”,{undef,[{rmbrDb,start,[],[]},

提问于
浏览
4

我的项目在... / deps中有许多依赖项,两个包含在... / apps中的Erlang应用程序 . rebar.config

{sub_dirs, ["apps/rmbrDb","apps/rmbrRest","rel"]}.
{lib_dirs, ["deps","apps"]}.

{deps, [
    {webmachine, "1.10.*", {git, "git://github.com/basho/webmachine", "HEAD"}},
    {riakc, ".*", {git, "git://github.com/basho/riak-erlang-client", "HEAD"}}
]}.

该项目编译( ./rebar get-deps compile )没有错误,包含的应用程序确实生成梁文件 .

违规的app文件如下所示:

{application,rmbrDb,
         [{description,"Database Api for Main"},
          {vsn,"0.0.1"},
          {modules,[rmbrDb,rmbrDb_app,rmbrDb_sup]},
          {registered,[rmbrDb_sup]},
          {applications,[kernel,stdlib]},
          {mod,{rmbrDb_app,[]}},
          {start_phases,[]}]}.

我尝试开始使用shell脚本:

exec erl -pa $PWD/ebin $PWD/deps/*/ebin $PWD/apps/*/ebin -boot start_sasl -s reloader -s rmbrDb -s rmbrRest

哪个产生:

{"init terminating in do_boot",{undef,[{rmbrDb,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

日志包含

=mod:rmbrDb
Current size: 7281
Current attributes: 836C0000000...
Current compilation info: 836C0000000...

=fun
Module: rmbrDb
Uniq: 118638513
Index: 0
Address: 0x000000001a52b6d0
Native_address: 0x0000000017c8d370
Refc: 1

这表明该模块已加载 .

rmbrDb_app文件包含:

-module(rmbrDb_app).
-behaviour(application).
-export([start/2, stop/1]).
-spec start(normal | {takeover, node()} | {failover, node()},
            any()) -> {ok, pid()} | {ok, pid(), State::any()} |
                      {error, Reason::any()}.
start(_StartType, _StartArgs) ->
    case rmbrDb_sup:start_link() of
        {ok, Pid} ->
            {ok, Pid};
        Error ->
            Error
    end.

因此定义了启动功能 .

我在OSX 10.9.4上工作,使用Erlang / OTP 17 [erts-6.1] [source] [64-bit] [smp:8:8] Erlang编译并启动了一些项目,安装是最近的 .

我不知道为什么do_boot无法启动rmbrDb

请注意,其他应用也无法启动 . 它以先到者为准崩溃 .

1 回答

  • 8

    erl-s 选项不会启动给定的应用程序,而是调用函数 . 函数名称及其参数可以作为额外参数给出,但是如果你只是写 -s rmbrDb ,函数名将默认为 start 并且参数列表为空列表,因此 erl 将尝试调用 rmbrDb:start() ,并且该函数未定义( undef ) . 有关更多信息,请参见the documentation page for erl .

    您应该考虑为您的应用程序创建一个版本 . this answer中有一些指示 .

相关问题