How to obtain list of connected users in openfire

the probelm is that XMPPServer.getInstance(); returns null

here is my code

XMPPServer xmpp = XMPPServer.getInstance();
SessionManager manager = xmpp.getSessionManager();
Collection sessions = manager.getSessions();
for (ClientSession session : sessions) {
String theResource = session.getUsername();
System.out.println(“The logedin users are” + theResource);
}

is there any need to change my openfire.xml file. i am using eclispse as ide and i have added openfire.xml in conf (subfolder) of my project

just attach openfire.xml in case of any changes