打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
java.io.EOFException: no more data available - expected end tag to close start tag <stream:stream><
PingManager.getInstanceFor(connection).setPingInterval(600);

I am working on a chat app using xmpp,As per our requirement we have three server Apache Tomcat 7,ejabbered 2.1.11 and 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

Using above library I am able to Connect with ejabberd and able to login with my login id and password but after some time of logging in connection gets close automatically and a am getting below stack trace

Sep 16, 2014 4:36:01 PM org.jivesoftware.smack.XMPPConnection callConnectionClosedOnErrorListenerWARNING: Connection closed with errorjava.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 callConnectionClosedOnErrorListenerWARNING: Connection closed with errorjava.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)

and above messages keeps repeating in loop in my eclipse console!!!

can anyone explain me

  1. What is the reason for the above error?
  2. How can I solve above error?

Thanks in advance!!!

asked Sep 17 '14 at 4:58
Dev
1,3761033
    
Did you ever figure this out? I am having the same issue. – B Rad Oct 9 '14 at 2:22
1  
in my use case reason for occurrence of above error was jabber server(ejabberd) was dropping connection after a fixed time interval ofcause when connection was ideal,so what i did was after completing my task say sending chat message i am disconnecting the xmpp connection[my usecase was i was creating a xmpp connection from a servlet which runs on Tomcat7 application server] this was one solution another one is as mention by @Flow you can place a connection listener on created xmpp connection object,it will listen to connection Closed With Error and you can try to reconnect to xmpp server! – Dev Oct 9 '14 at 5:07
    
I am not experienced in ejabberd but possibly this answer might help you. – sinner Dec 26 '14 at 17:28
up vote 0 down vote accepted
  1. What is the reason for the above error?

Then connection went down unexpectedly. For example because the server closed it in an unclean way.

  1. How can I solve above error?

There can be many causes for this. You should handle the exception and re-establish the connection.

answered Sep 17 '14 at 7:10
Flow
14.1k76296
    
Hiiii, I got same problem with ejabberd. We have recently migrated from openfire to ejabberd. We never came across this issue while using openfire. Any idea where to look at. – Abhishek Patidar Sep 16 '15 at 6:51

You need to set a heartbeat(ping) interval to overcome timeouts over idle connections. Timeouts need not necessarily be in the applications, they can be in the routers/switches in the path.in the example, 600 represents 10 minutes.

PingManager.getInstanceFor(connection).setPingInterval(600);

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Tomcat:IOException while loading persisted sessions: java.io.EOFException
java.io.EOFException解决
java.io.EOFException解决
android smack源码分析——接收消息以及如何解析消息
java实现简单XMPP发送消息和文件的简单例子
解决tomcat下的URL中文乱码问题的方法:
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服