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.
But the first program only gets started.How could i start two programs when the server starts.
What you mean by "starting programs" ? "<load-on-startup>" make the server loads the servlet class at the server startup rather than waiting till the first request. If you mean the same, how you verifed that two servlets are not loaded?
Use a HttpContextListner instead, its the first event that will take place, and place your configuration in the contextInitialized() method. the events that you want to occur when closing the app, can be put in the contexDestroyed() method.