-
1. Re: Startup Classes : Flux
starksm64 Sep 19, 2001 12:30 PM (in response to ksteo1)Write a custom MBean.
http://www.jboss.org/documentation/HTML/ch13s32.html -
2. Re: Startup Classes : Flux
ksteo1 Sep 19, 2001 10:31 PM (in response to ksteo1)Thanks Scott!
Will look into that, I believe that will solve the problem :). -
3. Re: Startup Classes : Flux
twutort Jun 24, 2003 9:31 AM (in response to ksteo1)I need to have a startup class like this that takes arguments like in weblogic. Is there a way I can do this and read in arguments from the xml file?
-
4. Re: Startup Classes : Flux
petertje Jun 25, 2003 2:53 PM (in response to ksteo1)You can set attributes for your mbean when you start it, for example in the user-service.xml file. See this file for an example.
Hth
Peter. -
5. Re: Startup Classes : Flux
dward2 Oct 24, 2003 12:25 PM (in response to ksteo1)You don't need to use MBeans. In the Servlet 2.3 spec, ServletContextListeners were introduced. Implement one of those and enter it an a war's web.xml file. Then add this war file to your ear that also contains your ejb-jar files (if you need more than just a web app). Then, you can trigger startup from the contextInitialized() method and shutdown on the contextDestroyed() method. This is a standard J2EE way of doing startup/shutdown hooks of J2EE applications, and is therefore appserver agnostic.
Oh yeah. If you can't use Servlet 2.3 spec, you can use a similar (though not as elegant) mechanism in 2.2. Write a Serlvet instead of a ServletContextListener, and do your startup/shutdown code in the init()/destroy() methods, respectively. Then in web.xml, register the servlet *and be sure to add* a <load-on-startup>1</load-on-startup> element (the # doesn't really matter unless you want to order it with other servlets).
To configure it, you can put a properties file or xml file in your jar next to the ServletContextListener (or Servlet) and load in the config using yourClass.getResource().