powered by Jive Software

Receiving exception code 500 when tyring to use Roster.createEntry()


I use roster.createEntry(myContact) to add an entry in my Roster (I use local openfire server to test).

these is my source code.

ConnectionConfiguration config = new ConnectionConfiguration("",5222);
                                    conn = new XMPPConnection(config);
                                    conn.login("375", "123");
                           Roster roster = conn.getRoster();
                                    roster.createEntry("450@domain", "Fulano Mengano",null);

It is throwing


Well, can anyone help me what’s wrong with my source code? or it is problem of Configuration openfire Server.?


Try a simple wait (thread sleep) after conn.connect(); to allow the client connected with OF server before perform further operation.

For a synchronous way try using the Connection.addConnectionCreationListener(this); and implement a simple event to handle the connection creation event.

Hopes that’s help.