mrDoctorWho / ejabberd_mod_apns

An ejabberd module to send PUSH messages to iOS devices through APNS
MIT License
33 stars 19 forks source link

Error when trying to start ejabberd after installing mod_apns #11

Closed apphipster closed 7 years ago

apphipster commented 8 years ago

I have a similar issues with the one from here: other issue

I am using ejabberd-16.08 on Mac OS Here are the steps I do to add the custom module into ejabberd:

$ ./erlc -I ejabberd/include mod_apns.erl

mod_apns.erl:8: can't find include file "ejabberd.hrl"
mod_apns.erl:9: can't find include file "logger.hrl"
mod_apns.erl:10: can't find include file "jlib.hrl"
mod_apns.erl:36: undefined macro 'DEBUG/2'
mod_apns.erl:85: undefined macro 'DEBUG/2'
mod_apns.erl:138: undefined macro 'DEBUG/2'
mod_apns.erl:160: undefined macro 'INFO_MSG/2'
mod_apns.erl:18: function iq/3 undefined
mod_apns.erl:18: function message/3 undefined
mod_apns.erl:18: function start/2 undefined
mod_apns.erl:12: Warning: undefined callback function depends/2 (behaviour 'gen_mod')
mod_apns.erl:14: Warning: record apns_users is unused
mod_apns.erl:69: Warning: function create_json/2 is unused
mod_apns.erl:72: Warning: function create_keyvalue/1 is unused
mod_apns.erl:77: Warning: function create_pair/1 is unused
mod_apns.erl:79: Warning: function add_quotes/1 is unused 
mod_apns:
  address: "gateway.push.apple.com"
  port: 2195
  certfile: "cert.pem"
  keyfile: "key.pem"
2016-09-14 16:12:22.125 [critical] <0.38.0>@gen_mod:start_module:162 Problem starting the module mod_apns for host <<"macbook.local">> 
 options: [{address,<<"gateway.push.apple.com">>},
           {port,2195},
           {certfile,<<"cert.pem">>},
           {keyfile,<<"key.pem">>}]
 error: undef
[{mod_apns,start,
           [<<"macbook.local">>,
            [{address,<<"gateway.push.apple.com">>},
             {port,2195},
             {certfile,<<"cert.pem">>},
             {keyfile,<<"key.pem">>}]],
           []},
 {gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,154}]},
 {lists,foreach,2,[{file,"lists.erl"},{line,1337}]},
 {ejabberd_app,start,2,[{file,"src/ejabberd_app.erl"},{line,76}]},
 {application_master,start_it_old,4,
                     [{file,"application_master.erl"},{line,273}]}]
2016-09-14 16:12:22.125 [critical] <0.38.0>@gen_mod:maybe_halt_ejabberd:170 ejabberd initialization was aborted because a module start failed.
-ifndef(LAGER).
-define(LAGER, 1).
-endif.

Do you have any suggestion? Any help is appreciated.

mrDoctorWho commented 8 years ago

Hi @apphipster The second commend on the issue you provided and the README says that you must compile the module with ejabberd itself.

apphipster commented 7 years ago

I managed to compile the module using the following command: (Attention: the path varies depending on the installed ejabberd version) $ bin/erlc -I lib/ejabberd-16.08/include/ -I deps/ -pa lib/ejabberd-16.08/ebin src/mod_apns.erl One warning is displayed: src/mod_apns.erl:12: Warning: undefined callback function depends/2 (behaviour 'gen_mod') Add the module into config file at /etc/ejabberd/ejabberd.yml Restart ejabberd.

In the file jeabberd.log there is an entry: 2016-09-26 12:43:39.575 [info] <0.6670.0>@mod_apns:start:154 mod_apns Has started successfully!

You can also check the presence of the module using the link: http://localhost:5280/admin/server/macbook.local/node/ejabberd@localhost/modules/ (replace "macbook.local" with your domain)

mrDoctorWho commented 7 years ago

Closing due to inactivity.