我有一个实现Smack 4.1.7的Java应用程序,我将其用作Openfire 4.0.2的模拟客户端.目前,Openfire正在我的localhost上运行.Smack可以使用此连接正确登录和验证:
XMPPTCPConnectionConfiguration conf = XMPPTCPConnectionConfiguration.builder()
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
.setServiceName(XMPP_HOST_NAME) // equals xmppDomain on server
.setUsernameAndPassword("user1", "pwd1")
.setResource("tester")
.setDebuggerEnabled(true)
.build();
Run Code Online (Sandbox Code Playgroud)
现在当Smack尝试创建或加入MUC时,请求超时(SmackException $ NoResponseException)和Openfire记录以下内容:
2016.07.03 18:58:54 org.jivesoftware.openfire.spi.RoutingTableImpl -
Unable to route packet. Packet should only be sent to available sessions and the
route is not available.
<presence id="WrkXH-6" from="user1@localhost/tester" to="user1@localhost/tester">
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack" ver="NfJ3flI83zSdUDzCEICtbypursw="/>
</presence>
2016.07.03 18:58:54 org.jivesoftware.openfire.spi.RoutingTableImpl -
Failed to route packet to JID: user1@localhost/tester packet:
<presence id="WrkXH-6" from="user1@localhost/tester" to="user1@localhost/tester">
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack" ver="NfJ3flI83zSdUDzCEICtbypursw="/>
</presence>
Run Code Online (Sandbox Code Playgroud)
我在服务器端和客户端都使用了"localhost","127.0.0.1"和我的机器名称作为XMPP_HOST_NAME,我不断收到同样的错误.任何帮助,将不胜感激.
我正在尝试在 jabber.at 上从 Smack for Android 创建一个帐户。这是我的代码:
XMPPTCPConnectionConfiguration conf= XMPPTCPConnectionConfiguration.builder()
.setServiceName("jabber.at")
.build();
XMPPTCPConnection connection = new XMPPTCPConnection(conf);
connection.addConnectionListener(xmppConnectionListener);
connection.connect();
AccountManager accountManager = AccountManager.getInstance(connection);
Map<String, String> map = new HashMap<String, String>();
map.put("username", usr);
map.put("password", pwd);
map.put("email", email);
accountManager.createAccount(usr, pwd, map);
Run Code Online (Sandbox Code Playgroud)
我有一个错误:
W/System.err? org.jivesoftware.smack.packet.XMPPError@2beba168
W/System.err? at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:217)
W/System.err? at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:198)
Run Code Online (Sandbox Code Playgroud)
我试过有和没有地图,同样的错误。根据 jabber.at 的 Mathias Ertl 的说法,可以远程创建帐户,所以我在某处做错了。任何的想法 ?