我尝试通过此代码连接到我的xmpp服务器
final String servicename = "my server ip";
XMPPTCPConnection connection;
public void Register(String userName, String password)throws XMPPException, SmackException, IOException
{
try{
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setServiceName(servicename)
.setUsernameAndPassword("admin username", "admin password")
.setCompressionEnabled(false).build();
connection = new XMPPTCPConnection(config);
connection.connect();
AccountManager AM = AccountManager.getInstance(connection);
AM.createAccount(userName, password);
connection.disconnect();
System.out.println(":)");
}
catch(XMPPException e){
System.out.println(":(");
}
}
所有代码都在try catch中,但是当我调用此函数时,没有任何内容被打印并出现错误。
我是java的新手,但我认为它从配置声明中得到错误
我从here
复制配置声明我该如何解决这个问题?
提前致谢