Embedding open fire in a Spring Java app

Hi,

Im completely new to XMPP and m trying to embed the open fire server in my java app, but am not sure how to go about it or even if its possible? So far i grabbed all the jars and added them to my project… but when i execute the following code:

XMPPServer server = new XMPPServer();

//new XMPPServerInfoImpl(“test123”, “127.0.0.1”, “3.7.1”, new Date(), connectionManager);

server.start();

server.stop();

But this fails with :

Could not locate home

java.io.FileNotFoundException

at org.jivesoftware.openfire.XMPPServer.locateOpenfire(XMPPServer.java:874)

You need to define the VM arg for -DopenfireHome so that the configuration and jar files are found.

There may be other things you need to do as well, but I don’t know what they may be. You should check how it is started in the startup.jar.

It is not easy as put all the Openfire jars in your CLASSPATH, it is useless and is not the right way.

Those jars have classes designed to be used only inside openfire server, so this is the reason why the installation directory error appears:

org.jivesoftware.openfire.XMPPServer.locateOpenfire(XMPPServer.java:874)

Instead of that you must use a independent but compatible XMPP library and then connect to the (Openfire) server.

Some libraries are: Smack, Tinder, Whack and XIFF which can be found in http://www.igniterealtime.org/downloads/index.jsp, but there are more libraries on Internet for many programming languages.