Will look into that, I believe that will solve the problem :).
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?
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.
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().