我们遇到此配置问题,通过http-bind连接到xmpp服务器。
BOSHConfiguration.Builder configBuilder = BOSHConfiguration.builder();
configBuilder.setUsernameAndPassword("user", "pass");
configBuilder.setHost("host.ltd");
configBuilder.setPort(port);
configBuilder.setFile("/http-bind/");
configBuilder.setUseHttps(false);
configBuilder.setServiceName("domain.ltd");
Bytestream stream = new Bytestream();
stream.setSessionID("123");
configBuilder.setResource(stream.toXML().toString());
AbstractXMPPConnection connection = new XMPPBOSHConnection(configBuilder.build());
try {
connection.connect();
Log.e("alert", "connected");
} catch (SmackException | IOException | XMPPException e) {
// TODO Auto-generated catch block
Log.e("alert", "problem : "+e);
e.printStackTrace();
}
我们尝试不用
Bytestream stream = new Bytestream();
stream.setSessionID("123");
configBuilder.setResource(stream.toXML().toString());
但仍未连接到服务器。
我们用pidgin检查服务器连接,其他bosh连接正常工作
错误日志:
05-02 18:42:50.806: E/(32344): appName=com.example.xvdsdvdd, acAppName=/system/bin/surfaceflinger
05-02 18:42:50.806: E/(32344): 0
05-02 18:42:51.055: E/AndroidRuntime(32344): FATAL EXCEPTION: AsyncTask #1
05-02 18:42:51.055: E/AndroidRuntime(32344): Process: com.example.xvdsdvdd, PID: 32344
05-02 18:42:51.055: E/AndroidRuntime(32344): java.lang.RuntimeException: An error occured while executing doInBackground()
05-02 18:42:51.055: E/AndroidRuntime(32344): at android.os.AsyncTask$3.done(AsyncTask.java:300)
05-02 18:42:51.055: E/AndroidRuntime(32344): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
05-02 18:42:51.055: E/AndroidRuntime(32344): at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
05-02 18:42:51.055: E/AndroidRuntime(32344): at java.util.concurrent.FutureTask.run(FutureTask.java:242)
05-02 18:42:51.055: E/AndroidRuntime(32344): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
05-02 18:42:51.055: E/AndroidRuntime(32344): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
05-02 18:42:51.055: E/AndroidRuntime(32344): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
05-02 18:42:51.055: E/AndroidRuntime(32344): at java.lang.Thread.run(Thread.java:841)
05-02 18:42:51.055: E/AndroidRuntime(32344): Caused by: java.lang.VerifyError: org/jivesoftware/smack/bosh/XMPPBOSHConnection
05-02 18:42:51.055: E/AndroidRuntime(32344): at com.example.xvdsdvdd.MainActivity$deletechannel.doInBackground(MainActivity.java:82)
05-02 18:42:51.055: E/AndroidRuntime(32344): at com.example.xvdsdvdd.MainActivity$deletechannel.doInBackground(MainActivity.java:1)
05-02 18:42:51.055: E/AndroidRuntime(32344): at android.os.AsyncTask$2.call(AsyncTask.java:288)
05-02 18:42:51.055: E/AndroidRuntime(32344): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-02 18:42:51.055: E/AndroidRuntime(32344): ... 4 more
有任何建议吗?