Smack bosh - IllegalStateException while connecting

时间:2016-08-31 18:09:57

标签: java xmpp smack bosh

I am using Smack 4.1.8 with all the related dependencies jars. Below is my code. Any help is much appreciated.

public static void main(String[] args) {
try {
    SmackConfiguration.DEBUG = true;        
    BOSHConfiguration conf = BOSHConfiguration.builder()
                            .setUsernameAndPassword("USER", "PASS")
                            .setFile("/http-bind/")
                            .setHost("BOSH_SERV")
                            .setPort(7070).setServiceName("TESTSERV")
                            .build();

    XMPPBOSHConnection connection = new XMPPBOSHConnection(conf);        
    connection.connect();
    connection.login();
    connection.disconnect();
} catch(Exception e){
    e.printStackTrace();
}
}

Exception:

org.jivesoftware.smack.SmackException$ConnectionException: java.lang.IllegalStateException: Could not load org.igniterealtime.jbosh.HTTPSender implementation
    at org.jivesoftware.smack.bosh.XMPPBOSHConnection.connectInternal(XMPPBOSHConnection.java:175)
    at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:364)
    at converse.chat.SmackTest.main(SmackTest.java:24)
Caused by: java.lang.IllegalStateException: Could not load org.igniterealtime.jbosh.HTTPSender implementation
    at org.igniterealtime.jbosh.ServiceLib.loadService(ServiceLib.java:83)
    at org.igniterealtime.jbosh.BOSHClient.<init>(BOSHClient.java:235)
    at org.igniterealtime.jbosh.BOSHClient.create(BOSHClient.java:368)
    at org.jivesoftware.smack.bosh.XMPPBOSHConnection.connectInternal(XMPPBOSHConnection.java:151)

Thanks!

0 个答案:

没有答案