Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wait for the server to start

 
Arthur Ford
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A servlet will not "start" until the server is up. But, a better way to do this is with a context listener.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic