Some notes on XMPP, pubsub, Smackx, and ejabberd.
- Smack and smackx employ a custom classloading scheme to load extensions at runtime. This mechanism looks for a configuration file in a specific place in a jar. If you are running from source (in an IDE) or do not have the file (from a custom build), the classloading scheme will fail. Rather than an error like “Can’t load extensions”, you’ll simply find intermittent ClassCastExceptions being thrown. Most if not all of the test suites will fail as well. Running from a binary jar or from a build utilizing the included build scripts is recommended.
- For PubSub to work with ejabberd, when creating the PubSubManager, you must specify the toAddress in the PubSubManager() constructor. If you do not do this subscriptions will fail. The toAddress that worked for me was “pubsub.” + connection.getHost().
- Psi is a great XMPP chat client for Linux that lets you see the raw XML. Smack also has a debug mode triggered by a system property that will create a Swing XMPP message log view.
- Do not expect to get blown away by the detail and verbosity of error messages from ejabberd.