xmppejabberdstrophe

BOSH module not started: Ejabberd / Strophe setup issue


Am trying to setup Strophe with Ejabberd on Ubuntu 12 (Linode latest version) using the internal Ejabberd webserver to serve the chat.

The test urls (http-bind and admin) both work.
JWChat works.
Strophe throws an error:

In Strophe:
RECV: <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='internal-server-error'>BOSH module not started</body>

In ejabberd.log:  
E(<0.468.0>:ejabberd_http_bind:1236) : 
You are trying to use BOSH (HTTP Bind) in host "admin", but the module mod_http_bind is not started in that host. 
Configure your BOSH client to connect to the correct host, or add your desired host`

Setup has been straightforward (though it took quite a while to work this out):

  1. Installed using sudo apt-get
  2. Running under sudo
  3. Using the internal server, to avoid messing with proxies or setting up PunJab.
  4. In ejabberd.cfg made changes.

Changes to ejabberd.cfg:

%% In listening ports, amended the following lines:  
{ request_handlers,  [   
   {["pub"], mod_http_fileserver},   
   {["http-bind"], mod_http_bind}  
]},  

%% In modules, added the following:  
{ mod_http_fileserver, [   
   {docroot, "/var/lib/ejabberd/www"},   
   {accesslog, "/var/log/ejabberd/access.log"}   
]},  
{mod_http_bind,  []},

Any help would be much appreciated.


Solution

  • The answer is rather obvious.

    Strophe requires the username in the following format:

    username@host
    eg. admin@example.com

    It otherwise assumes that the username is really the host, and since such a host doesn't exist, it throws an error that mod_http_bind is not started in that host

    This error is misleading at best, but it does technically explain the issue.
    I was trying to login with just the username [which worked fine in JWChat], hence the issue.

    In case this doesn't work, a checklist of some of the other things to verify:

    1. Make sure that your domain is added to /etc/hosts

      127.0.0.1    localhost.localdomain   localhost
      12.34.56.78  squire.example.com  squire
      
    2. Make sure that your domain is added to /etc/ejabberd/ejabberd.cfg

      %% Hostname
      Hostname {hosts, ["example.com","98.765.43.21","localhost"]}.
      
    3. Ensure that your username exists and is registered:

      ejabberdctl register username example.com password
      

      And if user is an admin, is included in ejabberd.cfg [Note: it must also be registered!]

      %% Admin user
      {acl, admin, {user, "", "localhost"}}.
      {acl, admin, {user, "admin", "example.com"}}.
      
    4. Check that the server is running:

      a. sudo ejabberdctl status  
      b. http://example.com:5280/admin  
      c. http://example.com:5280/http-bind
      
    5. If there are issues, restart using both (I know you don't need both in theory. In practice, sometimes using one or the other would not work right.)

      sudo /etc/init.d/ejabberd restart
      sudo ejabberdctl restart
      
    6. Check the logs - /var/log/ejabberd/ejabberd.log (see here).

    7. Install JWChat and try that (or, if you have JWChat, install Strophe).
      The following short tutorial is invaluable, follow it exactly: http://www.ejabberd.im/jwchat-localserver