“无法解析Presence数据包中的扩展数据包”错误,导致与Smack断开连接

时间:2014-03-11 20:34:21

标签: xmpp smack

我实现了一个永远在线的聊天客户端,并向不同的XMPP用户发送消息。此客户端连接到ejabberd服务器,并使用Smack在java中实现。

在1分钟后,客户端离线,然后在近15秒后重新上线。客户端控制台上显示的日志如下:

java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen...erd.cloudservicesplatform.biz/cspb2\' id=\'t5f8L-12\' type=\'result\'/>... @1:1264
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:279)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Failed to parse extension packet in Presence packet.
java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen
...<query xmlns=\'jabber:iq:version\'/>\n</iq>... @6:6
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:279)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Failed to parse extension packet in Presence packet.
java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen
...=\'cspbox107@dev-ejabberd.cloudservicesplatform.biz\'/></query></iq>... @6:292
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:279)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Failed to parse extension packet in Presence packet.

1 个答案:

答案 0 :(得分:0)

当收到格式错误的存在节时,Smack直到3.3.0抛出异常。此行为已随SMACK-390更改。

你应该:

  • 更新到最新的Smack版本(即撰写本文时为3.4.1)
  • 通知开发人员库/程序中出现格式错误的节有关错误的信息

编辑:仔细查看日志并且由于您没有提及使用的Smack版本,您似乎也可能只是收到了一个导致断开连接的格式错误的节(即使在Smack 3.4.1上,这也是一个不可恢复的错误。