This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
This is vendor-specific. However, to be as portable as possible it is best to place your logic in a class separate from your startup class. Then your vendor-specific startup class can act as a facade. Thus when you need to support multiple vendors it should be a simple process to write another facade for each specific application server.
Originally posted by Pradeep Bhat: How about ServletContextListener ?
That would be making the assumption that the application is using Servlets. Many J2EE Applications have the need for startup events and are not using Servlets. In these cases you are at the mercy of the Application Servers feature set.