[英]Exception in thread “main” java.lang.NoSuchFieldError: ifpossible
I am trying to establish a XMPP connection using the Smack library. 我正在尝试使用Smack库建立XMPP连接。 Using the version 4.2.0-beta2(smack-core) and 4.1.8(smack-tcp)
使用版本4.2.0-beta2(smack-core)和4.1.8(smack-tcp)
public void gcmConnect()
{
try{
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder().setHost(GCM_SERVER)
.setPort(GCM_PORT).setUsernameAndPassword("27614215340@gcm.googleapis.com", 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)
These are the possible reasons of getting this Exception
这些是获得此
Exception
的可能原因
1 . 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. 您必须验证您的
classpath
包含指定库的正确版本。
2 . 2 。 You might have got two versions of
jar
being used. 您可能已经使用了两个版本的
jar
。
3 . 3 。 Incomplete jar file
jar文件不完整
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.