oreilly.comSafari Books Online.Conferences.
Articles Radar Books  

Installing the Jabber Server
Pages: 1, 2, 3, 4

Monitoring and Troubleshooting the Server

We've already seen a glimpse of the configuration relating to logging of messages in the previous section. As standard, the Jabber server configuration describes two types of logging record and a recipient file for each type:



Error logging

Error log records are written to error.log in the current directory, as determined thus:


<log id='elogger'>
  <host/>
  <logtype/>
  <format>%d: [%t] (%h): %s</format>
  <file>error.log</file>
  <stderr/>
</log>

Statistical logging

Statistical log records used for tracking purposes are written to record.log in the current directory, as determined thus:


<log id='rlogger'>
  <host/>
  <logtype>record</logtype>
  <format>%d %h %s</format>
  <file>record.log</file>
</log>

Log records of this type are written when a client connects to the server and when a client disconnects.

Furthermore, we can use the debugging switch (-D) when we start the server and have debugging and trace output written to STDERR.

If Your Server Doesn't Start

A number of likely candidates might have prevented your server from starting.

Bad XML configuration

It is not difficult to make errors (typographical or otherwise) in the server configuration. The first line of defense is to be careful when editing your jabber.xml file. After that, the Jabber server isn't going to be too forthcoming with information if you have broken the well-formedness of the XML:


yak:~/jabber-1.4.1$ ./jabberd/jabberd -h yak
Configuration parsing using jabber.xml failed

Help is at hand in the shape of Perl and the XML::Parser module, which is a wrapper around the XML parser, expat.

Providing you have Perl and the XML::Parser module installed, you can get expat to give you a clue where the XML is broken:


yak:~/jabber-1.4.1$ perl -MXML::Parser 
      -e 'XML::Parser->new->parsefile("jabber.xml", ErrorContext => 3)'

not well-formed (invalid token) at line 47, column 35, byte 1750:
    be on one line, the server doesn't like it otherwise! :)
    -->

    <host><jabberd:cmdline flag="h"yak</jabberd:cmdline></host>
==================================^

    &lt;!--
    This is the custom configuration section for the
 at /usr/local/lib/perl5/site_perl/5.6.0/i586-linux/XML/Parser.pm line 185
yak:~/jabber-1.4.1$

This shows us exactly where the problcode is.[4] In this case, the close-tag symbol (>) had been inadvertently rcodeoved when replacing localhostwith yak.

No XML Is Bad XML!

If you don't use the -c switch to specify which configuration file to use, the standard jabber.xml is used. If that file can't be found, you get exactly the same error as if your XML was not well-formed. You've been warned!

Unable to listen on port(s)

Taking the standard jabber.xml configuration, the Jabber server tries to bind to and listen on two ports: 5222 (for client connections) and 5269 (for server-to-server connections). If other processes are listening to these ports, then the Jabber server can't start and you'll see something like this in the error log:


20010407T12:11:06: [alert] (-internal): io_select unable to listen 
     on 5222 [(null)]
20010406T12:11:06: [alert] (-internal): io_select unable to listen 
     on 5269 [(null)]

If this is the case, use the netstat command to check the status of the ports:


yak:~/jabber-1.4.1$ netstat -an | grep -E '5222|5269'
tcp        0      0 0.0.0.0:5269            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:5222            0.0.0.0:*               LISTEN

If you see entries like this, it means that processes have been bound to these ports on all IP addresses.[5]

For example, if 0.0.0.0:5222 is being listened to then you may have another instance of a Jabber server already running.

On some BSD systcodes, you cannot bind to the "default" null address; the same error messages will be issued as if the ports were already bound. In the standard jabber.xml configuration file, a bind to the null address is specified for each port as standard; you must change this and specify an explicit IP address for each of the ports in the configuration. That is, instead of:


<ip port="5222"/>

do something like this:


<ip port="5222">127.0.0.1</ip>

Footnotes

[1]In fact, the next patch level version of the Jabber server, 1.4.2, which is available already, has the modifications necessary for it to be compilable under Mac OS X.

[2]If you want the Jabber server to support SSL connections, you will need to have installed an SSL package; see the next chapter for more details.

[3]The "zones" are the filenames that immediately follow the timestamp in the debug log records, for example, xdb_file or deliver. Specifying one or more zones will limit debug output to lines that pertain to those zones.

[4] Better highlighting of problcodes in parsing the configuration file is available in Version 1.4.2 of the server. You're told where the configuration is broken or if there were problcodes opening the file.

[5]This "all" relates to the (null) shown in the unable-to-listen error messages shown earlier.


DJ Adams is the author of O'Reilly's Programming Jabber book.


O'Reilly & Associates recently released (December 2001) Programming Jabber.





P2P Weblogs

Richard Koman Richard Koman's Weblog
Supreme Court Decides Unanimously Against Grokster
Updating as we go. Supremes have ruled 9-0 in favor of the studios in MGM v Grokster. But does the decision have wider import? Is it a death knell for tech? It's starting to look like the answer is no. (Jun 27, 2005)

> More from O'Reilly Developer Weblogs


More Weblogs
FolderShare remote computer search: better privacy than Google Desktop? [Sid Steward]

Data Condoms: Solutions for Private, Remote Search Indexes [Sid Steward]

Behold! Google the darknet/p2p search engine! [Sid Steward]

Open Source & The Fallacy Of Composition [Spencer Critchley]