WSServlet and Multiple Web Services

Posted on 2009-02-11
Medium Priority
Last Modified: 2013-11-24
I'm reading about WSServlets at http://forums.java.net/jive/thread.jspa?messageID=261509
And would like to ask about <load-on-startup>1</load-on-startup>, how do the numbers work?
Where or what is this number compared to?

The <load-on-startup> that I have, have duplicate numbers and the complete sequence is not there.  The numbers jump form 1 to 8 and 9, then 11.  Granted each of the web.xml files are not related.
Question by:chima
  • 2
LVL 60

Expert Comment

by:Kevin Cross
ID: 23618119
Hello chima,

The number specified as content of this tag is the order in which the servlet should be loaded if it matters.  So you don't need to have all the numbers in sequence.  Just note that the servlet(s) with value of 1 will be loaded before servlet(s) with value of 8, 9, or 11.


LVL 60

Accepted Solution

Kevin Cross earned 2000 total points
ID: 23618127
(here is a nice explanation -- http://wiki.metawerx.net/wiki/Web.xml.LoadOnStartup)

This tag specifies that the servlet should be loaded automatically when the web application is started.

The value is a single positive integer, which specifies the loading order. Servlets with lower values are loaded before servlets with higher values (ie: a servlet with a load-on-startup value of 1 or 5 is loaded before a servlet with a value of 10 or 20).

When loaded, the init() method of the servlet is called. Therefore this tag provides a good way to do the following:

    * start any daemon threads, such as a server listening on a TCP/IP port, or a background maintenance thread
    * perform initialisation of the application, such as parsing a settings file which provides data to other servlets/JSPs

If no  value is specified, the servlet will be loaded when the container decides it needs to be loaded - typically on it's first access. This is suitable for servlets that don't need to perform special initialisation.

Author Closing Comment

ID: 31545753

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question