Cannot login to jive messenager2.2.2

I am using jive messenager2.2.2 as server,and I have tested the “liwei” account with PSI client.

I cannot login to server with Smack lib.I tried with Smack2.0.0 and Smack-dev-2005-11-10,both failed.

The code is below:

private static String username = “liwei@liwei”;

private static String password = “liwei”;

private static String serverName = “liwei”;

private static int port = 5222;

public static void main(String[] args) throws Exception {

XMPPConnection.DEBUG_ENABLED = true;

XMPPConnection con = new XMPPConnection(serverName, port);

con.login(username, password);

con.createChat(“bible@liwei”).sendMessage(“How are you?”);

}

the exception is:

Exception in thread “main” (401)

at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication .java:94)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:414)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:374)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:355)

at xmpp.XmppClient1.main(XmppClient1.java:19)

and the debug panel info is:

You need to just put liwei as your username as opposed to liwei@liwei.

Alex

Thank you,I have resolved my problem according your answer.