powered by Jive Software

Connect from Java Application to Openfire Server

Good day to you all.

I managed to get the Openfire server working with my own database.

I have developed an application where I login with a user and I use some methods of changing data.

Right now, I would like to allow a user to see which contacts that he/she has are also logged in, so I can develop a chat among them.

My problem is that I do not know how to login the user from my Java application into the Openfire server.

I am searching through the Java Docs and I cannot find any method that allows me to do that,

to login a user that is already in the database into Openfire from my own application.

Would you mind lending me a hand with this, please?

Thank you very much and have a nice day.

I think I have found out how…

// Configure Connection to OpenFire Server

ConnectionConfiguration config = new ConnectionConfiguration(SERVER_IP_ADDRESS, SERVER_PORT);

config.setCompressionEnabled(true);

config.setSASLAuthenticationEnabled(true);

Connection connection = new XMPPConnection(config);

// Connect to the server

try {

connection.connect();

}

catch (XMPPException e) {

// Error while connecting

e.printStackTrace();

return null;

}

// Log into the server

try {

connection.login(USERNAME, PASSWORD, “SomeResource”);

}

catch (XMPPException e) {

// Error while logging in

e.printStackTrace();

return null;

}

yes thats looks good and even i tried too. But still can’t able to connect to openfire with java application