powered by Jive Software

Cannot do a simple connect!

I am using the following code:[/b]

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

import org.jivesoftware.smack.Chat;

import org.jivesoftware.smack.packet.Message;

import org.jivesoftware.smack.Roster;

import java.util.Iterator;

public class Test

{

public static void main( String args[] )

{

try

{

XMPPConnection con = new XMPPConnection(“myserver.com”);

}

catch( XMPPException ex )

{

}

}

}

and get the following dump.[/b]

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 …xmlns=’‘http://jabber.org/features/iq-register’’/></stream:features>… @1:442

at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3014)

at org.xmlpull.mxp1.MXParser.more(MXParser.java:3025)

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:337)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:42)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:62)

I am able to connect to the same server using different clients. Any ideas? /b

Try enabling the smack debug window and paste the xml that’'s sent from the server

is that all the code you have? what are you doing to keep your program from exiting? One thing i see right off the bat, though i think this is just a code snippet otherwise you wouldn’‘t need all of those imports, is that your connection is scoped to your try block, if you don’'t have any references to it elsewhere i would guess it would be garbage collected.

I am simply attempting to do a normal connect and then send a message to another account. It is not getting past the connect part. Here is the dump with debug on. I did some research here at the forum and I found that it MIGHT be linked to some parsing problem. Other clients are able to connect with no problem, but these few lines of code do not. All of the imports are still there because I forgot to delete them. I had alot more code for a simple Smack “hello world!”.

here is the dump:

java.lang.reflect.InvocationTargetException

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor Impl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor AccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:274)

at org.jivesoftware.smack.XMPPConnection.initReaderAndWriter(XMPPConnection.java:8 59)

at org.jivesoftware.smack.XMPPConnection.init(XMPPConnection.java:747)

at org.jivesoftware.smack.XMPPConnection… @1:442

at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3014)

at org.xmlpull.mxp1.MXParser.more(MXParser.java:3025)

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:337)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:42)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:62)

/b

thanks in advance!

Message was edited by:

kloidster

You need to run your apt with -Djava.awt.headless=true to get rid of the X11 errors. You’'ll also not be able to use the visual debugger (is there a non visual debugger?).

Noah

Thanks for the lookup, but still no dice. I just want to make a smack based client that runs from the command line. If anybody has had any success with this, then that’'ll save us all some time…

Did it get rid of the X11 errors?

Noah

Yes, the X11 errors were muted. Any idea of what might be causing the other errors? I actually am looking to create a chat bot that is based on Smack. I figured that I would play around with the API and then start writing something more serious.