Hi, You should implents ServletContextListener to get the context () :
http://www.roseindia.net/servlets/ServletContextListener-example.shtml @Override public void contextInitialized(ServletContextEvent arg0) { if (context == null) { context = arg0.getServletContext(); } } It works well in my case ;) On Thu, May 19, 2011 at 11:30 AM, Mateu Yabar <mateu.ya...@foodreg.com>wrote: > Hi to all, > > I need to obtain the number of active sessions on the current application. > If written the following (import org.apache.catalina.Context, import > org.apache.catalina.Manager): > public int getActiveSession(){ > Context context=null; > Manager manager=context.getManager(); > return manager.getActiveSessions(); > } > > However I don't know who to get the current context. Is there any static > method from which I can get it? > > THanks in advance! >