编程语言
首页 > 编程语言> > java.io.EOFException:没有更多可用数据 – 关闭开始标记的预期结束标记

java.io.EOFException:没有更多可用数据 – 关闭开始标记的预期结束标记

作者:互联网

我正在使用xmpp开发聊天应用程序,根据我们的要求,我们有三个服务器Apache Tomcat 7,ejabbered 2.1.11和mysql 5.5,

to run xmppbot on tomcat  used below library
    -Smack-core-4.0.3.jar
    -smack-tcp-4.0.3.jar
    -xlightweb2.5.jar
    -xpp3-1.1.3.3.jar
    -xSocket-2.4.6.jar

使用上面的库我能够与ejabberd连接并能够使用我的登录ID和密码登录但是在登录连接的一段时间后自动关闭并且我正在低于堆栈跟踪

Sep 16, 2014 4:36:01 PM org.jivesoftware.smack.XMPPConnection callConnectionClosedOnErrorListener
WARNING: Connection closed with error
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 ...</text></error></iq>... @1:1347
    at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2919)
    at org.xmlpull.mxp1.MXParser.more(MXParser.java:2928)
    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1112)
    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1061)
    at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:279)
    at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:47)
    at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:81)
Sep 16, 2014 4:37:15 PM org.jivesoftware.smack.XMPPConnection callConnectionClosedOnErrorListener
WARNING: Connection closed with error
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 ...</text></error></iq>... @1:1347
    at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2919)
    at org.xmlpull.mxp1.MXParser.more(MXParser.java:2928)
    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1112)
    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1061)
    at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:279)
    at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:47)
    at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:81)

以上消息在我的eclipse控制台中不断重复循环!

任何人都可以解释我

>上述错误的原因是什么?
>我如何解决上述错误?

提前致谢!!!

解决方法:

  1. What is the reason for the above error?

然后连接意外地下降了.例如,因为服务器以不干净的方式关闭它.

  1. How can I solve above error?

这可能有很多原因.您应该处理异常并重新建立连接.

标签:java,ejabberd,smack,asmack
来源: https://codeday.me/bug/20190703/1363164.html