Erlang "Kernel pid terminated" 错误

Erlang "Kernel pid terminated" error

我尝试使用relx进行发布申请。 Relx 毫无问题地做到了。但是当我开始申请时,出现错误:

{"Kernel pid terminated",application_controller,"
{application_start_failure,iqServer,{bad_return,{{iqServer_app,start,[normal,[]]},  
{'EXIT',{undef,[{iqServer_app,start,[normal,[]],[]},
{application_master,start_it_old,4,[{file,\"application_master.erl\"},
{line,272}]}]}}}}}"}

据我从错误中了解到,我在函数 iqServer:start/2 中遇到了问题。 start/2 看起来像这样:

-module(iqServer).
-behaviour(application).

-export([start/2, stop/1]).

start(_StartType, _StartArgs) ->
    Dispatch = dispatch_rules(),
    {ok, _} = cowboy:start_http(http_listener, 100, [
        {ip,{127,0,0,1}}, 
        {port, 6000}], [
        {env, [{dispatch, Dispatch}]}
    ]),
    iqServer_sup:start_link().

stop(_State) ->
    ok.

dispatch_rules() ->
    cowboy_router:compile([
        {'_', [
            {"/test/", cowboy_static, {file, "priv/index.html"}},
            {"/test/:group/:method", iqServer_test_handler, []}
        ]}
    ]).

之前我通过以下命令启动我的应用程序:erl -pa ebin deps/*/ebin -s iqServer 并且运行良好。现在也不知道哪里出问题了

这是我的 iqServer.app.src 文件:

{application, iqServer,
 [
  {description, "Test app"},
  {vsn, "0.1"},
  {registered, [iqServer]},
  {applications, [
                  kernel,
                  stdlib,
                  crypto,
                  cowlib,
                  ranch,
                  gproc,
                  cowboy
                 ]},
  {mod, { iqServer_app, []}},
  {modules, [
      iqServer,
      .....
      iqServer_sup,
      iqServer_tools
      ]}
 ]}.

生成文件:

PROJECT = iqServer

DEPS = cowboy sync gproc jsx epgsql
COMPILE_FIRST = iqServer_api_method
ERLC_OPTS = +debug_info
dep_cowboy = git https://github.com/ninenines/cowboy.git HEAD
dep_gproc = git git://github.com/esl/gproc.git HEAD
dep_jsx = git git://github.com/talentdeficit/jsx.git HEAD
dep_epgsql = git git://github.com/epgsql/epgsql.git HEAD

include erlang.mk

relx.config:

{release, {iqServer, "1"}, [iqServer]}.

{extended_start_script, true}.
{sys_config, "rel/sys.config"}.

{vm_args, "rel/vm.args"}.

在您的应用程序文件中,您有这一行:

  {mod, { iqServer_app, []}},

也就是说,启动应用程序时,应该调用iqServer_app模块中的start/2函数。但是,您的应用程序回调模块名为 iqServer。更改应用文件中的模块名称,或重命名模块。