This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Run Servlet on deployment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Run Servlet on deployment" Watch "Run Servlet on deployment" New topic

Run Servlet on deployment

Ron Patel

Joined: Apr 11, 2004
Posts: 18

I'm very perplexed on using servlets for my Web Service. I find that Application Servers do not call init() on my servlet until the very first time an RPC call is received.

This seems very limited to me. My Web Services require background threads to be running processing data while waiting for users to make RPC calls.

Is there any way to force the Application Server to call init on my Web Service at deployment time and not at the time the very first RPC call is received?

Peer Reynders

Joined: Aug 19, 2005
Posts: 2906
Have tried "load-on-startup" in your web.xml deployment descriptor?

"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
Ron Patel

Joined: Apr 11, 2004
Posts: 18
This works fine for the Axis servlet. I failed to mention that I am using Apache Axis as my Web Service Engine. How do I tell Apache Axis to call init on my Web Service on startup?
I agree. Here's the link:
subject: Run Servlet on deployment
Similar Threads
First time only SOAPException while invoking a web service
service interface in both web.xml and webservices.xml?
init and service in same thread?
When init() method is called?
Instantiating Servlet