[erlang-questions] Simple OTP Application error

Ulf Wiger ulf.wiger@REDACTED
Thu Jul 2 20:08:59 CEST 2009


The 'undef' part of the error means that erlang
couldn't find the function hda_app:start/2.

Check that your module has been compiled and is
accessible via the code path.

BR,
Ulf W

Andrea Di Persio wrote:
> Hi!
> 
> I'm trying to build a simple otp application to dive deeper in erlang.
> 
> I'm following the example in Joe Armstrong 'Programmin Erlang'  and I
> also tried with some example on the web but I can't make it work
> correctly.
> 
> The application load correctly but when I run application:start
> (appname) I get this error:
> 
> application: hda
>     exited: {bad_return,
>                 {{hda_app,start,[normal,[]]},
>                  {'EXIT',
>                      {undef,
>                          [{hda_app,start,[normal,[]]},
>                           {application_master,start_it_old,4}]}}}}
>     type: temporary
> {error,{bad_return,{{hda_app,start,[normal,[]]},
>                     {'EXIT',{undef,[{hda_app,start,[normal,[]]},
>                                     {application_master,start_it_old,
> 4}]}}}}}
> 
> 
> 
> If I run the supervisor alone, it work correctly.
> 
> 
> 
> This is my   _app file:
> 
> -module(hda_app).
> -behaviour(application).
> -export([start/2, stop/1]).
> 
> 
> 
> start(_Type, _Args) ->
>     hda_supervisor:start_link().
> 
> 
> stop(_State) ->
>     ok.
> 
> 
> 
> This is my .app file:
> 
> {application, hda,
>  [{description, "Help Desk Assistant"},
>   {vsn, "1.0"},
>   {modules, [hda_app, hda_supervisor, customer_server,
> hda_alarm_handler]},
>   {registered, [customer_server]},
>   {applications, [kernel, stdlib, sasl]},
>   {mod, {hda_app, []}}
>  ]}.
> 
> 
> This is my supervisor:
> 
> 
> -module(sellaprime_supervisor).
> -behaviour(supervisor). % see erl -man supervisor
> 
> -export([start/0, start_in_shell_for_testing/0, start_link/1, init/
> 1]).
> 
> 
> 
> start() ->
>     spawn(fun() ->
>             supervisor:start_link({local,?MODULE}, ?MODULE, _Arg =
> [])
>     end).
> 
> 
> start_in_shell_for_testing() ->
>     {ok, Pid} = supervisor:start_link({local,?MODULE}, ?MODULE, _Arg =
> []),
>     unlink(Pid).
> 
> 
> start_link(Args) ->
>     supervisor:start_link({local,?MODULE}, ?MODULE, Args).
> 
> 
> init([]) ->
>     %% Install my personal error handler
>     gen_event:swap_handler(alarm_handler,
>                            {alarm_handler, swap},
>                            {my_alarm_handler, xyz}),
>                            {ok, {{one_for_one, 3, 10},
> 
>     {ok, {{one_for_one, 3, 10},
>           [{tag1,
>             {customer_server, start_link, []},
>              permanent,
>              10000,
>              worker,
>              [customer_server]}
>           ]}}.
> 
> 
> 
> Best regards,
> Andrea.
> 
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
> 


-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com


More information about the erlang-questions mailing list