用asmack api连接openfire服务器的时候,报错如下:
W/System.err(22102): java.lang.IllegalStateException: Not connected to server.
03-21 16:50:15.857: W/System.err(22102): at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:488)
03-21 16:50:15.858: W/System.err(22102): at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication.java:69)
03-21 16:50:15.858: W/System.err(22102): at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:353)
03-21 16:50:15.858: W/System.err(22102): at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:230)
03-21 16:50:15.858: W/System.err(22102): at org.jivesoftware.smack.Connection.login(Connection.java:353)
03-21 16:50:15.858: W/System.err(22102): at com.seu3s.main.LogInActivity$2.run(LogInActivity.java:90)
03-21 16:50:15.858: W/System.err(22102): at java.lang.Thread.run(Thread.java:856)
openfire服务器端解决办法:
“服务器设置”--“安全设置”---将“客户端安全联接”中由“非必须”,修改为“自定义”,另外把“旧的SSL方式”和“TLS方式”都设置为无效。