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

Hi,

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("127.0.0.1",5222);
                                    conn = new XMPPConnection(config);
                                    conn.connect();
                                    conn.login("375", "123");
                           Roster roster = conn.getRoster();
                  roster.setSubscriptionMode(SubscriptionMode.accept_all);
                                    roster.createEntry("450@domain", "Fulano Mengano",null);

It is throwing

“internal-server-error(500)”

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

thx

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.