An error with Erlang router
===

I try to make a comet-server using Mochiweb like [there][1].

But I try to start 1st node with mochiweb from command line:

    erl -pa ebin edit deps/*/ebin -boot start_sasl -sname n1 -s server +K true -setcookie secret_key -s reloader

And 2nd one with router:

    erl -pa ebin edit deps/*/ebin -boot start_sasl -sname router -setcookie secret_key -eval 'net_adm:ping(n1@localhost), router:start_link().'

If I connect to mochiweb from browser I have this error

    =CRASH REPORT==== 18-Jul-2012::19:04:45 ===
    crasher:
    initial call: mochiweb_acceptor:init/3
    pid: <0.73.0>
    registered_name: []
    exception exit: {noproc,
                        {gen_server,call,
                            [undefined,{login,"234567e",<0.73.0>}]}}
      in function  gen_server:call/2
      in call from server_web:loop/2
      in call from mochiweb_http:headers/5
    ancestors: [server_web,server_sup,<0.55.0>]
    messages: []
    links: [<0.57.0>,#Port<0.1406>]
    dictionary: [{mochiweb_request_qs,
                      [{"session_id","234567e"},{"obj_id","page"}]},
                  {mochiweb_request_path,"/polling"}]
    trap_exit: false
    status: running
    heap_size: 2584
    stack_size: 24
    reductions: 1516

I think that problem is in this string from router.erl:

    -define(SERVER, global:whereis_name(?MODULE)).

Because first part of -eval (**net_adm:ping(n1@localhost)**) was started without errors and I could see **n1@localhost** in **nodes().**. But the second part of -eval (**router:start_link()**) was not available for **?MODULE**.

How can I resolve this problem?



  [1]: http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-2