Error trying to connect smack to openfire

0

I'm trying to make a simple example to connect to an openfire server using the smack 4.0.6 library and I have the following code:

ConnectionConfiguration configuration= new ConnectionConfiguration(ADDRESS, 5222);
configuration.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);
SSLContext sc = null;
try {
    sc = SSLContext.getInstance("TLS");
    sc.init(null, new TrustManager[] { new AcceptAllTrustManager() }, new SecureRandom());
} catch (Exception e1) {
    e1.printStackTrace();
}
configuration.setCustomSSLContext(sc);
XMPPConnection connection = new XMPPTCPConnection(configuration);
try {
   connection.connect();
} catch (Exception e) {
   e.printStackTrace();
   return;
}

The part of the TSL protocol it manages to accomplish completely, however, when I try to connect it it returns the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jivesoftware/smackx/disco/ServiceDiscoveryManager
at org.jivesoftware.smackx.hoxt.HOXTManager$1.connectionCreated(HOXTManager.java:43)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.initConnection(XMPPTCPConnection.java:490)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPConnection.java:440)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:811)
at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:396)
at Main.main(Main.java:56)

Which leads me to believe that what is missing is a library that has the definition of class ServiceDiscoveryManager . In the meantime I've imported all the libraries that are provided by Ignite and it still does not work.

What dependency is missing for it?

    
asked by anonymous 27.01.2015 / 19:12

1 answer

1

The org.jivesoftware.smackx.disco.ServiceDiscoveryManager class belongs to the smack extensions module.

Just include the smack-extensions jar next to the smack jar in your project.

    
30.01.2015 / 18:14