Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

load on startup

 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to start two servlets along with the server starts up.In my web.xml,i have configured like:


But the first program only gets started.How could i start two programs when the server starts.please assist me to solve this.

Thanks
 
Vijitha Kumara
Bartender
Pie
Posts: 3918
10
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<servlet-class> this tag should contain class name with package.
If your Servlets are Voicebroadcast1, busy1 without package, then fine.

Check your servers log file, Is there any exception comming on server start up?
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi preethi,

Actually <load-on-startup>1</load-on-startup> is use just load your servlet to load into container.

The basic of why this need is when your servlet complex and it takes time to load on container then you just load that servlet at start of your server.

basically the servlet get load into container when first user request for that servlet. so, if your servlet takes time to load when user request at that time you just load servlet.

 
mike ickx
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic