[erlang-questions] Simple OTP Application error

91 views
Skip to first unread message

Andrea Di Persio

unread,
Jul 2, 2009, 11:56:55 AM7/2/09
to erlang-q...@erlang.org
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

unread,
Jul 2, 2009, 2:08:59 PM7/2/09
to Andrea Di Persio, erlang-q...@erlang.org

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


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

Andrea Di Persio

unread,
Jul 3, 2009, 10:07:10 AM7/3/09
to erlang-q...@erlang.org
Bingo!
I didn't compiled all the application file.

Now it work like a charm!


Thank you very much!

> > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html


> > erlang-questions (at) erlang.org
>
> --
> Ulf Wiger

> CTO, Erlang Training & Consulting Ltdhttp://www.erlang-consulting.com


>
> ________________________________________________________________
> erlang-questions mailing list. Seehttp://www.erlang.org/faq.html
> erlang-questions (at) erlang.org

________________________________________________________________

Reply all
Reply to author
Forward
0 new messages