This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes load-on-startup doubt ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "load-on-startup doubt ..." Watch "load-on-startup doubt ..." New topic
Author

load-on-startup doubt ...

Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Hi,

When i use the <load-on-startup> tag in the DD, the Servlet is loaded at deploy time, this is ok with me. But, does the <load-on-startup> call the init method on that Servlet ?

Please clear my doubts ...

Thanks in advance ...


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
You might like to try something like a servlet with code such as


public void init(){
ServletContext ctx = getServletContext();
ctx.log("initializing");
}

Then restart your container without requesting the servlet and see what is in the the log.

Marcus


SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Yes,

Loading also initializes. It will take you to the point where in when your first request comes in, it starts with the service method.


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Thank you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: load-on-startup doubt ...
 
Similar Threads
Deploy struts app
load-on-startup of servlet tag in DD
servlet start up on server initialization
Can i run a servlet on tomcat startup?
Static Initialization Block