Error! A startup class specified in smack-config.xml could not be loaded

Hello,

first off, I’‘m relatively new to Java and XMPP, so you’'ll have to excuse myself if I did something really stupid

I heard of Smack and tought that it must be really neat and quickly threw together a little test class. Sending a message works as expected, but I keep getting errors after it was sent. Maybe you’‘ll know better. Googling and searching the forums didn’'t return anything useful

Here’'s the complete code (of course I replaced the usernames and passwords with real jabber accounts):

import org.jivesoftware.smack.*;

public class HelloJabberClass {

public static void main(String[] args) {

XMPPConnection connection = new XMPPConnection(“web.de”);

try {

connection.connect();

} catch (XMPPException e) {

e.printStackTrace();

}

try {

connection.login(“maik.hoepfel”, “ubersecretpwd”);

} catch (XMPPException e) {

e.printStackTrace();

}

Chat chat = connection.getChatManager().createChat("test@test.de", null);

try {

chat.sendMessage(“Moritz, mein großer Held!”);

} catch (XMPPException e) {

e.printStackTrace();

}

}

}

The error I get is:

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.ServiceDiscoveryManager

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.XHTMLManager

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.muc.MultiUserChat

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.filetransfer.FileTransferManager

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.LastActivityManager

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.ServiceDiscoveryManager

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.XHTMLManager

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.muc.MultiUserChat

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.filetransfer.FileTransferManager

Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.LastActivityManager

I’'m confused as I did not even load smackx… shrug The only thing that I did different from what the examples in the docs said is that I did not include a function to be called when a message is received, simply because the example gave me compiler errors.

Thanks.

Message was edited by: edelholz

edelholz,

It is very simple: you need to specify in the CLASSPATH the smackx package. Although you do not use it explicitely, there’'re classes and packages in Smack that do use smackx package.

An example java-execution for your test application yould be like this one:

java -Dappdir=… -cp …/smack.jar;…/smackx.jar; ./HelloJabberClass.jar HelloJabberClass

I assume your application resides in the default source tree of the Smack distribution (for example C:\Smack\src\target\bin). If the paths are different, you should replace them with the correct ones in the java-command line example above.

Hope to helped you.

Kind regards,

sbogus

Message was edited by: sbogus