aspose file tools*
The moose likes Servlets and the fly likes Wait for the server to start Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Wait for the server to start" Watch "Wait for the server to start" New topic
Author

Wait for the server to start

Arthur Ford
Greenhorn

Joined: Sep 06, 2006
Posts: 22
I am using Apache Axis in weblogic 8.1. Now the problem with webservices is that we need to "register" the webservice by running "AdminClient". Normally this is done via Command prompt AFTER the server has started up. But now I am looking to automate this..what I did was put this "AdminClient" thing in a servlet and in the init method...but obviously it got executed before the server could start up and I get a "Connection refused" error.

I was wondering if there is a way for my servlet to wait until the server has started and then execute.

something like...

while(server_has_not_started){
--dont do anything
}
if(server_has_started){
--execute
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61190
    
  66

A servlet will not "start" until the server is up. But, a better way to do this is with a context listener.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
How can the following be possible.

what I did was put this "AdminClient" thing in a servlet and in the init method...but obviously it got executed before the server could start up and I get a "Connection refused" error.


After the server starts up, then it initializes the various application contexts one by one and when you applications turn comes , it loads all the servlets with load on startup tag.So your servlet is getting executed after the servers starts.

One more thing related to this.Your servlet that had the code for adminclient of axis might be getting executed before the axis servlet is getting initialized.You can load the axis servlets using load on startup like your initializing servlet but with less numeric value than what you set for your servlet.

But for such purposes context listners are more prefered.


Rahul Bhattacharjee
LinkedIn - Blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61190
    
  66

And while we're at it...

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
Arthur Ford
Greenhorn

Joined: Sep 06, 2006
Posts: 22
Hi Folks, Thanks for the replies...I did try and arrange the "load-on-startup" for the servlets...but I am still stuck with the same problem

This is how my web.xml looks


And this is what I get...

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61190
    
  66

"Arthur Darklord", My request that you change your display name to adhere to JavaRanch standards was not a suggestion. Valid display names are mandatory for participation on the Ranch. Please change your display name as instructed prior to your next post.

Be aware that accounts with invalid display names are disabled.

bear
JavaRanch Sheriff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wait for the server to start