Java.io.EOFException: No more data available - expected end tag </ stream: stream> to close start tag <stream: stream>

I am working on a chat app using xmpp. As per our requirement, we have three Apache Tomcat 7 servers, 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 the above library, I can connect to ejabberd and login with my login id and password, but after some time logging into the connection, it closes automatically and I get below the stack trace

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)

      

and above messages keep repeating in a loop in my eclipse console !!!

can someone explain to me

  • What is the reason for the above error?
  • How can I solve the above error?

Thanks in advance!

+3


source to share


2 answers


  • What is the reason for the above error?

Then the connection dropped unexpectedly. For example, because the server closed it in an unclean way.



  1. How can I solve the above error?

There may be many reasons for this. You must handle the exception and reconnect.

0


source


You need to set an interval (ping) to overcome the idle connection timeouts. Timeouts do not have to be in applications, they can be in routers / switches along the way. In example 600 is 10 minutes.



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

+1


source







All Articles