Reputation: 87
I am trying to establish a XMPP connection using the Smack library. Using the version 4.2.0-beta2(smack-core) and 4.1.8(smack-tcp)
public void gcmConnect()
{
try{
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder().setHost(GCM_SERVER)
.setPort(GCM_PORT).setUsernameAndPassword("[email protected]", API_KEY).build();
XMPPTCPConnection connection = new XMPPTCPConnection(config);
connection.connect();
System.out.println("Connected");
}
catch(XMPPException ex)
{
ex.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
XMPPConnectionTest obj = new XMPPConnectionTest();
obj.gcmConnect();
}
It gives the following error
Exception in thread "main" java.lang.NoSuchFieldError: ifpossible
at org.jivesoftware.smack.ConnectionConfiguration$Builder.<init>(ConnectionConfiguration.java:438)
at org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration$Builder.<init>(XMPPTCPConnectionConfiguration.java:91)
at org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration$Builder.<init>(XMPPTCPConnectionConfiguration.java:87)
at org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration.builder(XMPPTCPConnectionConfiguration.java:80)
at com.inn.foresight.gcm.XMPPConnectionTest.gcmConnect(XMPPConnectionTest.java:32)
at com.inn.foresight.gcm.XMPPConnectionTest.main(XMPPConnectionTest.java:53)
Upvotes: 0
Views: 1815
Reputation: 15864
These are the possible reasons of getting this Exception
1. You probably compile using one version of a library, but use another version at run-time . You must verify that your classpath
contains the proper version of the specified library.
2. You might have got two versions of jar
being used.
3. Incomplete jar file
Upvotes: 1