File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to check whether server is running or not

 
Sivakumar Nachimuthu
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My EJBs are deployed in server.
In case server is not running and i lookup the bean in client using context.lookup() ..
Exception is shown that connection refused like this




So i want to check whether server is running before i lookup.How can i do that?
Thanks in advance
Siva

[ October 27, 2004: Message edited by: Sivakumar Nachimuthu ]
[ October 27, 2004: Message edited by: Sivakumar Nachimuthu ]
 
Gaurav Chikara
Ranch Hand
Posts: 412
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do a ping on the server to see if it responds
 
Sivakumar Nachimuthu
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Server machine may be running.
But i want to know whether Jboss server running
in the remote server machine in the port 1099.

Thanks
Siva
[ October 27, 2004: Message edited by: Sivakumar Nachimuthu ]
 
Anand Gondhiya
Ranch Hand
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
telnet http://[machine-name]:[port]/

for ex: http://www.javaranch.com
 
Sivakumar Nachimuthu
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yaa u r right.but i want know thru my java code whether server running in the remote machine in th port 1099.
siva
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sivakumar Nachimuthu:
yaa u r right.but i want know thru my java code whether server running in the remote machine in th port 1099.
siva



Hello Siva,
I think you should try using java.net package for this purpose.
 
Siplin Ayishoto
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why dont you catch that exception? (it is not a runtime exception...)
Also, I dont see what you can achieve by knowing it 'beforehand'.
-Siplin
[ November 10, 2004: Message edited by: Siplin Ayishoto ]
 
Sivakumar Nachimuthu
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we cant catch these exception.The Above exception was caught inside jboss naming server and printStackRace of exception is printed by jboss naming service.

Siva
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic