powered by Jive Software

java.lang.ClassCastException when use "GoogleTalkConnection"

i checked the souce code of smack from svn server and wrote a test application, in my test class, i wrote the following code:

//----


XMPPConnection con

= new GoogleTalkConnection();

con.login(“", "”);

//----


But when i run the test application, i get an error says that :

java.lang.ClassCastException

at org.jivesoftware.smack.SASLAuthentication.bindResourceAndEstablishSession(SASLA uthentication.java:299)

at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 209)

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

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

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

at JabberTest.main(JabberTest.java:19)

(405)

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

at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 223)

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

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

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

at JabberTest.main(JabberTest.java:19)

//----


debug output show error occur in the "XMPPConnection " line, how to resolve this problem?

Hey whuige,

The url=http://www.jivesoftware.org/community/entry.jspa?externalID=461&categoryID=1 8"Why am I getting java.lang.ClassCastException?"[/url] KB document explains the reason and possible solution for this common problem. Let me know if you are still having problems or if you have any recomendation on how to improve the KB document.

Regards,

– Gato

thx, it works.~~~.