Error
I modified some configuration in ejabberd. When I try to start ejabberd, I get some error messages similar to:
=CRASH REPORT==== 30-Aug-2007::14:03:04 === crasher: pid: <0.228.0> registered_name: ejabberd_listeners error_info: {start_spec,{duplicate_child_name,5222}} initial_call: {gen,init_it, [gen_server, <0.204.0>, <0.204.0>, {local,ejabberd_listeners}, supervisor, {{local,ejabberd_listeners},ejabberd_listener,[]}, []]} ancestors: [ejabberd_sup,<0.35.0>] messages: [] links: [<0.204.0>] dictionary: [] trap_exit: true status: running heap_size: 610 stack_size: 21 reductions: 2132 neighbours: =SUPERVISOR REPORT==== 30-Aug-2007::14:03:04 === Supervisor: {local,ejabberd_sup} Context: start_error Reason: {start_spec,{duplicate_child_name,5222}} Offender: [{pid,undefined}, {name,ejabberd_listener}, {mfa,{ejabberd_listener,start_link,[]}}, {restart_type,permanent}, {shutdown,infinity}, {child_type,supervisor}] =CRASH REPORT==== 30-Aug-2007::14:03:04 === crasher: pid: <0.34.0> registered_name: [] error_info: {bad_return,{{ejabberd_app,start,[normal,[]]}, {'EXIT',{badarg, [{erlang, port_control, [stringprep_port, 1, "jabber.example.org"]}, {stringprep,control,2}, {jlib,nameprep,1}, {ejabberd_auth,auth_modules,1}, {ejabberd_auth,'-start/0-fun-1-',1}, {lists,foreach,2}, {ejabberd_app,start,2}, {application_master,start_it_old,4}]}}}} =CRASH REPORT==== 26-Sep-2007::20:52:29 === crasher: pid: <0.39.0> registered_name: [] error_info: {bad_return, {{ejabberd_app,start,[normal,[]]}, {'EXIT', {noproc, {gen_server, call, [ejabberd_hooks, {add, ejabberd_ctl_process, "atenea", ejabberd_auth, ctl_process_get_registered, 50}]}}}}} ...
Explanation
ejabberd complains that the same port is defined several times in the 'listen' section of the configuration. This is an example of wrong configuration:
{listen, [{5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper}, starttls, {certfile, "/path/to/server.pem"}]}, {5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper}]}, {5269, ejabberd_s2s_in, [{shaper, s2s_shaper}]} ]}.
Solution
Change ejabberd configuration and make sure each port is only defined once. The previous example can be fixed by simply commenting or removing the lines that you don't need:
{listen, [{5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper}, starttls, {certfile, "/path/to/server.pem"}]}, %% {5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper}]}, {5269, ejabberd_s2s_in, [{shaper, s2s_shaper}]} ]}.