private SocialApp getSocialApp() throws JAXBException, IOException { ServletContext application = (ServletContext) context.getMessageContext().get(MessageContext.SERVLET_CONTEXT); synchronized (application) { SocialApp socialApp = (SocialApp) application.getAttribute("socialApp"); if (socialApp == null) { socialApp = new SocialApp(); socialApp.setFilePath(application.getRealPath("users.xml")); application.setAttribute("socialApp", socialApp); } return socialApp; } }