I am running the Stripes web application on Jboss 4.2.3.GA and trying to call a method when starting JBoss. I created a ServletContextListener as follows:
public class TimerContextListener implements ServletContextListener { @Inject private TimerManager timerManager; public void contextInitialized(ServletContextEvent servletcontextevent) { ((Injector) servletcontextevent.getServletContext().getAttribute(GuiceServletContextListener.KEY)).injectMembers(this); timerManager.stopAllTimers(); timerManager.startTimer(); } public void contextDestroyed(ServletContextEvent servletcontextevent) { } }
and I added an entry to web.xml as follows:
<listener> <listener-class>com.lawless.web.servletContextListeners.TimerContextListener</listener-class> </listener>
but contextInitialized () is called 3 times when I start my server. Any idea what could be the problem? Thanks.
java servlets jboss stripes
Brian
source share