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.
Hello, I was wondering if it was possible to runtime exec a process on another server. For instance I am on server one and I have accessible rights to server two. I would like the user to call a servlet on server one that executes a process on server 2. How would I go about doing this? Any help would be appreciated... Thank you, Maneesh
client (probably with browser) --> servlet1-server1--->servlet2@server2 If this is the case; @servlet1 create a URL Object with target to URL of server2-servlet2... but I am not sure yet.. please try and inform..
I reviewed the API but am still unsure about doing this. yes, that is correct. I am trying to access the servlet from a browser that will then call a process on server 1 which should call a process on server 2. any further information... Thank you, Maneesh
Maybe this helps: To call a Servlet from Java (Another servlet or any Java code) you could use this:
You are working with Java, so you can send anything to the servlet (like an Objet), not just a URLEncoded string. If you just want to do a GET (previous was a POST), you can change :
to exec the process :
Hope this helps...
Joined: Aug 26, 2002
also, there is no servlet on server 2. This server only has processes running on it and this process would need to run somehow... browser-->servlet1-->serverProc1-->server2-->serverProc2 Thank you, Maneesh
Author and all-around good cowpoke
Joined: Mar 22, 2000
I suggest you experiment with the Runtime exec methods outside the servlet environment first. There are a lot of things that can go wrong and mixing in all the things that can go wrong with servlets does not help. Important points: Read the api for java.lang.Process carefully. You will need to capture the output of the resulting process using Threads that read the stdout and stderr streams. If you don't read these streams, the process may freeze-up mysteriously. Bill