Java code to Ping on a server?
I have multiple instances of JBoss server connected through different port on a single machine. I have IP address and port no. Now I want to write code to know which instance of the server is up(running) and which one is down using ip address and port no. If anybody know it, please tell me.
Thanks in advance.
http://www.ibutton.com/TINI/index.html
http://www.ajile.com/products.htm
Similar Messages
-
Retrieving user data from Directory Server using java code
Can anyone send java code to bind to directory server and retrieve the user information from server instance.
To CRabel,
My company have restriction on using the open sources product/code, but i will take a look on netscape ldap sdk as a reference~
To raghu1978 ,
i find a product call Directory Editor 1 2005Q1, I hope it is useful.
thz all~ -
Java code to make connection to web server??
Hi,
we are looking at simple java code to connect to IIS Server and retrive a ZIPed file.
this zip file contains photos. all individual photos are stored in zip file under doc root of IIS server..
any sample code will be greatHere is some code on how to open an URL and read from it.
url = new URL("http://IIS_server/doc/Yourfile.zip");
URLConnection conn = url.openConnection();
conn.setDoInput(true);
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer sbResponse = new StringBuffer();
int intChar = 0;
while ((intChar = in.read()) !=-1) {
// got one byte as int from the server do something here to pass the byte from one stream to another (filestream)
// there is a way to save to the local HD with an applet but you have to sign it and adjust some security policys
in.close(); -
How to change the properties of a directory using java code
Hai All,
I need to change the properties of directory( websharing).
Can i do this using java code.
Regards,
CharanI need to change the properties of
directory( websharing).
an i do this using java code.Depends on whether the server has a Java API to do it. Most likely it hasn't. -
Need platform independent java code for TNS PING
Hi, I am able to ping server /ip address. but unable to ping some TNS entry.
There is one way to ping TNS entry using System command, but that will make my code platform dependent. i want platform independent code.. need code help for TNS Ping to database server.. here are my code:
---Code for server / Ip address ping:---------
package DBM;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import oracle.net.TNSAddress.*;
public class PingServer
public static void main(String[] args)
System.out.println(" Server Pinging Starts...");
ArrayList<String> list=new ArrayList<String>();
list.add("g5u0660c.atlanta.hp.com");
list.add("g1u1675c.austin.hp.com");
list.add("gvu1785.atlanta.hp.com");
list.add("10.130.14.109");
list.add("10.130.0.173");
list.add("DESCRIPTION = (SDU = 32768) (enable = broken) (LOAD_BALANCE = yes) (ADDRESS = (PROTOCOL = TCP)(HOST = gvu1515.atlanta.hp.com)(PORT = 1525))(ADDRESS = (PROTOCOL = TCP)(HOST = gvu1785.atlanta.hp.com)(PORT = 1525)");
list.add("IDSENGI");
//This Ipadd variable is used to convert the arraylist into String
String ipadd="";
try
for(String s: list)
ipadd=s;
// InetAddress is class.in this class getByName()is used to take only string parameter.
InetAddress inet = InetAddress.getByName(ipadd);
//InetAddress inet1 =InetAddress.getAllByName("IDESENGP");
System.out.println("Sending Ping Request to " + ipadd);
//in InetAddress call IsReachabe(3000)method is used to ping the server IP and if ping is successfully then return true otherwise false.
//IsReachable()take time in millisecond and return type is boolean.
System.out.println("Host is reachable: "+inet.isReachable(3000));
System.out.println("Server Pinging program is working fine........");
catch (UnknownHostException e)
System.err.println("Host does not exists");
catch (IOException e)
System.err.println("Error in reaching the Host");
----Code for TNS ping using system host----
package DBM;
import java.io.*;
public class doscmd
public static void main(String args[])
try
Process p=Runtime.getRuntime().exec("cmd /c tnsping IDSENGP");
p.waitFor();
BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=reader.readLine();
while(line!=null)
System.out.println(line);
line=reader.readLine();
catch(IOException e1) {}
catch(InterruptedException e2) {}
System.out.println("Done");
The above two codes are working absolutely fine... but need TNS ping program is platform dependent..we need to deploy it in both windows, unix...
Please help.You don't need to install another JDK, just use the api from 1.2 and you should be fine. You can even use the 1.4 jdk to compile as if it were 1.2 by using the -target option in javac.
-
Java code to create a new .txt file in FTP server --- Help
Hi,
I wrote a standalone java app which creates a .txt file in my local machine and transfers it to FTP server. But my requirement now is to create a new .txt file with the same content in FTP server itself instead of creating locally with basic java code.
I'm aware of transfering file from local machine to the FTP server using STOR command of FTP. But i never tried creating a new file & writing content into that in FTP server.
So, if any one did this before please help me out with source code or any idea ???
Thank you.
Vj.simply_vijay wrote:
thanks for your reply. yes i've seen the Apache Commons NET API , but there is no method or class to create a new file in FTP server. I'm really worried how to solve this problem ???Sure there is.
There's a method where you can write data to a file on the server using an OutputStream, right? Well, instead of writing to a FileOutputStream, write to that OutputStream instead. Remember to close the OutputStream and call the method which says you're finished with the command (I forget what it's called). -
How to call Java script from java code?Can Jscript be executed at server?
Hi All,
We are using 'WebTrends' tool to analyze our site usage pattern.
To use WebTrends, we need to :
1) call Java Script code from the java code
2)Java script has to be executed at server.
Please comment on two points mentioned above. If yes, please let me know how to do them?
Thanks in advnce,
Regards,
GangaYou can check out Rhino project.
[http://www.mozilla.org/rhino/] -
Hi floks,
I had i trickey situation in which my application is creating the locks over the tables in the
DB(SQL server 2000) . Iam using Struts frame work 1.1 + jsp in our application.
Iam bit worried wether the locks can be removed with the java code which suits the Struts
framework...
Please help me with proper code snippet to over come the situation.
Thanks in anticipation
Shiviam looking to make a query in such a way that it can be triggered with
java code whish removes all the locks
is it possible...?
i tried the nolock situation even i cant get the situations
and the query where it is getting locked as our application is big enough with
numerous number of queries -
How Server can read client side SSL certificates through java code?
My code will be running on server which will be a java class that should read any SSL certificates for the user that is logging in to the application.
Kindly let me know how it can be achieved ? I have very rare knowldge on Security. how i can read SSL certificates of the client machine.
Also let me know the possible solutions for above question.For my mud written in java, I used TCP/IP for the connections. When a client connects, he gets his own thread. Those threads are held in a vector in a manager class. each tick of the server does a quick run thru the vector and if the current thread/socket its on is null or !isAlive() its remove from the vector(which in turn removes it from getting any more game updates. This removal can be caused by two things. The clients disconnects by accident(kills his game, locks up has an internet connection hiccup, etc.) or he uses the games "quit" method. The quit method calls a method that does any player saving of data, etc then closes the socket, and sets it to null. thus the manager sees this and removes him frm the vecotr list on the next server tick. Seems to work great form a mud and worked really well in a multiplayer applet game I had up for a while.
-
Unable to create a folder through java code on weblogic server 10GR3
Hi,
I have java code which creates a folder and writes an XML file in to it.
File saveDirectory = new File(storePath);
if(!saveDirectory.exists()){
System.out.println("directory doesnt exists");
boolean isDirectoryCreated = saveDirectory.mkdir();
System.out.println("directory doesnt exist creating status :"+isDirectoryCreated);
This code works fine on my local weblogic server.Whereas the one installed on Unix box is not.
saveDirectory.mkdir() is unable to create a directory at the given path.
I feel there is some permission problems.
Please let me know what can be done.
Thanks,I have my Linux/Unix Admin either add me to a group that can do this or create one that can and add me to it.
If you command prompt can you manually do it now?
Best Regards
mseberg -
Hi,
How do I get the server info i.e server IP address etc using Java code. Pl. note that this is from the business layer and not from Front end.
thankshello Pfister,
I'll send you one article link , just go thru it ,
you can many examples from basics. if you get any errors just take that error no. which displayed , you can find the solution for that error in the link.
This link you can see one good example:
http://www.onjava.com/pub/a/onjava/excerpt/java_cookbook_ch18/index.html?page=5
Regards,
Varun -
Start weblogic server within java code
From edoc.bea.com, I got:
====
The following sections describe alternate ways to start an Administration Server:
Starting an Administration Server from the Windows Start Menu
Starting an Administration Server When the Host Computer Boots
Starting an Administration Server With the java weblogic.Server Command
====
Could we start weblogic server within java code?
(like ServerLoader provided by JBoss?)
Thanks in advance.
-KevinThe follwoing code:
//====
import weblogic.*;
public class MyTest
public static void main(String[] args)
String[] myArgs = new String[6];
myArgs[0] = "-Dweblogic.home=C:\\bea";
myArgs[1] = "-Dweblogic.RootDirectory=C:\\bea\\weblogic81\\samples\\domains\\examples";
myArgs[2] = "-Dweblogic.ConfigFile=C:\\bea\\weblogic81\\samples\\domains\\examples\\config.xml";
myArgs[3] = "-Dweblogic.Name=examplesServer";
myArgs[4] = "-Dweblogic.management.username=weblogic";
myArgs[5] = "-Dweblogic.management.password=weblogic";
Server.main( myArgs );
//====
Seems that did not feed the arguments in:
C:\myTest>java -cp .;%CLASSPATH% MyTest
<Sep 22, 2005 6:08:40 PM EDT> <Info> <Security> <BEA-090065> <Getting boot ident
ity from user.>
Enter username to boot WebLogic server: -
How to get the Weblogic Server Id from within java code
I would like to log which server (among a cluster) a certain job is running on. Is there a way to get the server id from within Java code (this code is in a session bean if that is relevant.)
By server id I mean the "Name" column in the summary of servers on the weblogic console.
Thanks,
kenUse the two entries close to the bottom of the page: "list WebLogic
MBeans:listMBeans.jsp
display MBean attributes and operations:showMBean.jsp"
Nils
Anatoly wrote:
>
Cameron,
That page has these items on it:
which one do you think helps with my issue?
Misc WebLogic examples
LongRunningTask
Execute tasks in parallel using WebLogic Execute Threads
Weblogic stats (5.1)
Reload Servlet(s) programmatically (5.1)
Network classload from WebLogic:using reflection,or the launcher
Weblogic 5.1 debugging properties
Seppuku pattern readme
Using dynamic proxies to intercept EJB invocations (6.1)
list WebLogic MBeans:listMBeans.jsp
display MBean attributes and operations:showMBean
Thanks to Marcelo Caldas for filter by type option and nice UI!
Using com.sun.jdmk.comm.HtmlAdaptorServer with WebLogic 6.1
Cool
EJBGen
Dimitri
back
"Cameron Purdy" <[email protected]> wrote in message news:<3c7a745d$[email protected]>...
JMX ... see http://dima.dhs.org/misc/ for some info on JMX in Weblogic.
Peace,
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/
"Anatoly" <[email protected]> wrote in message
news:[email protected]..
Does anyone know who to get the managing server URL's port
from within the EJB code running on Weblogic 6.1?
The URL port is not default (not 7001), but when creating
initial context, I am not specifying the URL in properties.
Due to that, trying to the the PROVIDER_URL property from
environment does not return anything.
Appreciate any responses.
-Anatoly
============================
[email protected] -
Getting problem when connecting to SMTP server through java code
Hi all,
I am getting problem when i am going to connect with "Kerio SMTP server" through java code. The error what i am getting is :
"[16/Sep/2008 15:59:09] Sent: Queue-ID: 48cf8a73-000000f9, Recipient: <[email protected]>, Result: failed, Status: 5.3.2 554 5.0.0 Too many hops (101, max 100), message looping" when sending an email from [email protected]Looks like something is set up wrong on your server that's causing messages
to be forwarded around a loop too many times without ever reaching the destination.
For instance, if server A forwards to server B, and server B forwards to server A,
this would happen. -
Problem when ping the mail server.
i want to ensure whether the mail server is started in the particular machine.thru the java code how can i ping.
Sexy liddle Servlet for yer;-
import java.io.*;
import javax.servlet.http.*;
public class TestPingServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
response.setContentType("text/plain");
String target = request.getParameter("ip");
PrintWriter out = response.getWriter();
Process pingProc = Runtime.getRuntime().exec(new String[] { "ping", target });
BufferedReader procOutput = new BufferedReader(new InputStreamReader(pingProc.getInputStream()));
String line;
while((line = procOutput.readLine()) != null) {
out.println(line);
pingProc.waitFor();
out.close();
catch(Exception e) {
e.printStackTrace();
}
Maybe you are looking for
-
Deploy par files with code from NWDI
Hello Experts, I have migrated some par files to NWDI and they are deployed via SDM as SDA files. From eclipse it is possible to deploy the par files with Code. Is this possible from NWDI that the par files are deployed with code to the portal server
-
Adding new fields to Item Data - PO (ME
Hi All, Is it possible to add new custom fields to PO Item Data in Confirmations tab and these new fields are required only in PO Change (ME22N). How can we achieve this! Can anybody provide feasible solution for the same! can anybody tell me if this
-
How to transfer the picture and video from ipad to pc
I want to transfer the picture and video from ipad to pc while we restoring the ipad?
-
I always get this error when starting up AE just right when the flash screen appears. AE then crashes. Any help appreciated.
-
Does toothpaste remove the apple logo on an iPhone?
I have small scratches on the back of my iPhone 4s and one on the apple logo. I read that toothpase does remove scratches, which I'm happy about, but I've seen some before-after pictures and the logo and the text are gone! If I do apply toothpase to